local DebrisService = game:GetService("Debris")
local rp = game:GetService("ReplicatedStorage")
local Thunder1 = rp:WaitForChild("Thunder1")
local Debris = game:GetService("Debris")
local debounce = false
Thunder1.OnServerEvent:Connect(function(Player)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
--Here you can Add animations
local Firing = Humanoid:LoadAnimation(script.Anim)
Firing:Play()
wait(1)
local BV = Instance.new("BodyVelocity", Player.Character.HumanoidRootPart)
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BV.Velocity = Player.Character.HumanoidRootPart.CFrame.LookVector*-200 -- This is how fast you will go in the air
game.Debris:AddItem(BV, 0.1) -- this one deletes the velocity so you stop flying up
local Hitbox = script.Hitbox:Clone()
Hitbox.CFrame = Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,0,0) --This is where the fireball will spawn, so it can be UpperTorso, Left Hand, Right Hand, Head, Etc.
Hitbox.Orientation = Character:WaitForChild("HumanoidRootPart").Orientation
Hitbox.CanCollide = true
local Weld = Instance.new("ManualWeld")
Weld.Part0 = Hitbox
Weld.Part1 = Character:WaitForChild("HumanoidRootPart")
Weld.C0 = Hitbox.CFrame:inverse() * Character:WaitForChild("HumanoidRootPart").CFrame
Weld.Parent = Hitbox
spawn(function()
for i = 0, 1000 do
wait()
Hitbox.Size = Hitbox.Size + Vector3.new(0,0,0)
end
end)
Hitbox.Parent = workspace
Debris:AddItem(Hitbox,1)--How long until it disappears
local Vel = Instance.new("BodyVelocity",Hitbox)
Vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Vel.Velocity = Character:WaitForChild("HumanoidRootPart").CFrame.lookVector * 0 --Speed of Fire Ball
Hitbox.Touched:Connect(function(Hit)
if not Hit:IsDescendantOf(Character) then
if Hit:IsA("Part") or Hit:IsA("MeshPart") then
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health > 0 and debounce == false and not Humanoid:FindFirstChild("Attacker") and not Humanoid:FindFirstChild("Fireball") then
local Attacker = Instance.new("ObjectValue",Humanoid)
Attacker.Name = "Attacker"
Attacker.Value = Player
DebrisService:AddItem(Attacker,3)
local Hitbox = Instance.new("ObjectValue",Humanoid)
Hitbox.Name = "Hitbox"
DebrisService:AddItem(Hitbox,3)
local creator = Instance.new("ObjectValue",Humanoid)
creator.Name = "creator"
creator.Value = Player
Humanoid:TakeDamage(20)
end
end
end
end)
wait(0.1)
debounce = false
Thunder1:FireClient(Player)
end)
My ability keeps on flinging how do i stop it from happening here is the local script
local Player = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local Thunder1 = rp:WaitForChild("Thunder1")
--KeyPresses and Inputs
local UIS = game:GetService("UserInputService")
local debounce = false
local cooldown = 10
script.Parent.Activated:Connect(function()
Thunder1:FireServer()
end)
Thunder1.OnClientEvent:Connect(function()
wait(cooldown)
debounce = true
end)