So i change the localscript .connect on lines 3 and 9 to :Connect, and the damage works fine but still the animation isn't working :( IDK what ive done wrong.
ScreenShots of my games setup is shown in the screenshots, code will be pasted below:
Link to Game Setup: https://imgur.com/a/ejoF9
Link to Script: https://imgur.com/a/Aqcmq
Link to LocalScript: https://imgur.com/a/wUxNS
Script Code:
script.Parent.blade.Touched:connect(function(p)
if script.Parent.CanDamage.Value == true then
script.Parent.CanDamage.Value = false
p.Parent.Humanoid:TakeDamage(20)
end
end)
LocalScript Code:
local CanAttack = true
script.Parent.Equipped:Connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
idle:Play()
end)
script.Parent.Activated:Connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
if CanAttack == true then
attack:Play()
idle:Stop()
CanAttack = false
wait(1)
attack:Stop()
idle:Play()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)

3 comments
You're using '.connect' on line 9 on the local script code, instead of :Connect. (Tip: Use :Connect as :connect is deprecated.)
Also on line 3.
thx bro