Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Local Script
- local UIS = game:GetService("UserInputService")
- local mouse = game.Players.LocalPlayer:GetMouse()
- local debounce = false
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- --Animation--
- local animInstance = Instance.new("Animation")
- animInstance.AnimationId = "rbxassetid://4586797999"
- local FireBallAnim = humanoid:LoadAnimation(animInstance)
- --Key Code--
- UIS.InputBegan:Connect(function(Key, processed)
- if processed or debounce then return end
- debounce = true
- if Key.UserInputType == Enum.UserInputType.Keyboard then
- if Key.KeyCode == Enum.KeyCode.Z then
- FireBallAnim:Play()
- game.ReplicatedStorage.Events.SkillActivation1:FireServer(mouse.Hit.Position)
- end
- end
- wait(1)
- debounce = false
- end)
- --Server Script Service
- game.ReplicatedStorage.Events.SkillActivation1.OnServerEvent:Connect(function(player, mousePos)
- local effects = game.ReplicatedStorage.Effects
- local fireBall = effects.MagicSkill:Clone()
- local explosion = effects.Explosion:Clone()
- local character = player.Character
- --Fireball--
- fireBall.Position = character.RightHand.Position
- fireBall.Parent = workspace
- --Weld--
- local weld = Instance.new("WeldConstraint", fireBall)
- weld.Part0 = fireBall
- weld.Part1 = character.RightHand
- wait(0.1)
- weld:Destroy()
- local velocity = Instance.new("BodyVelocity", fireBall)
- velocity.Velocity = CFrame.new(fireBall.Position, mousePos).LookVector * 100
- --Explosion--
- fireBall.Touched:Connect(function(hit)
- if hit:IsDescendantOf(character)or hit:FindFirstChild("ParticleEmitter") then return end
- explosion.Position = fireBall.Position
- fireBall:Destroy()
- explosion.Parent = workspace
- if hit.Parent:FindFirstChild("Humanoid") then
- hit.Parent:FindFirstChild("Humanoid"): TakeDamage(30)
- end
- game.ServerScriptService.MagicSkill.Disabled = true
- game.StarterPlayer.StarterPlayerScripts.SkillActivation.Disabled = true
- wait(5)
- game.ServerScriptService.MagicSkill.Disabled = false
- game.StarterPlayer.StarterPlayerScripts.SkillActivation.Disabled = false
- wait(5)
- explosion:Destroy()
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment