but where would i insert a script like this? what line specifically?
Here’s the script
--Local stuff
local tool = script.Parent
local CoolDown = script.Cooldown.Value
local animation = script.Animation --Put the name of the animation here!
local damage = (10) --damage amount
local connection = nil
--Config
--You can change Cooldown.
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChildWhichIsA('Humanoid')
if humanoid and CoolDown == false then
CoolDown = true
local playanim = humanoid:LoadAnimation(animation)
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)--the player
local character = player.Character
print("Working 2!")
playanim:Play()
--Damage Script
connection = character["Right Arm"].Touched:Connect(function(h)
if h.Parent:FindFirstChildOfClass("Humanoid") then
local OtherHumanoid = h.Parent.Humanoid
OtherHumanoid:TakeDamage(10)
end
end)
print("Working 3!")
wait(0.5)
playanim:Stop()
print("Working 4!")
wait(0.4)
print("Working 5!")
CoolDown = false
print("Working 6!")
end
end)
print("Working 2!")
playanim:Play()
--Damage Script
local hasHit = false
connection = character["Right Arm"].Touched:Connect(function(h)
if h.Parent:FindFirstChildOfClass("Humanoid") then
if hasHit then return end
local OtherHumanoid = h.Parent.Humanoid
OtherHumanoid:TakeDamage(10)
hasHit = true
end
end)
print("Working 3!")
wait(0.5)
playanim:Stop()
connection:Disconnect()
print("Working 4!")
wait(0.4)