I have been trying to make a light saber with particle emitters. All that is left are the animations. Can someone help me make a script for the animations? I tried making my own, but it just makes errors when I test it. Local Script: local CanAttack = true
script.Parent.Equipped:connect(function() local equip = script.Parent.Parent.Humanoid:LoadAnimation(script.equip)
equip:Play() end)
script.Parent.Activated:connect(function()
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
if CanAttack == true then
attack:Play()
CanAttack = false
wait(1)
attack:Stop()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)
Result: Equip: https://gyazo.com/edab2155e5626f1fe1e279b7310d7aa0.gif Attack: https://i.gyazo.com/554a8a6065fb9ba272ceaecccfbed17f.gif

2 comments
Use Lua CodeBlock to make your script more organized.
These are just mistakes you're making in the animation editor, your scripting is okay.