so im trying to run an animation in a while loop but the animation just stops working and it doesnt work right
idk whats wrong but here is my code
local slash1 = Instance.new("Animation")
slash1.AnimationId = "http://www.roblox.com/Asset?ID=166956234"
local swordslash1 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(slash1)
function swordslash()
print'animating'
animating = true
swordslash1:Play()
wait(3)
animating = false
end
animating = false
function update()
if script.Parent.Equipped.Value == "IronSword" then
sword.BrickColor = BrickColor.new("Dark stone grey")
mesh.MeshId = "rbxasset://fonts/sword.mesh"
mesh.TextureId = ""
if script.Parent.Button1DownValue.Value == true then
if animating == false then
swordslash()
end
end
end
end
while wait() do
update()
end

2 comments
Look at line 15. Is that path right? You may one to change the StringValue's name because there is no Value of the Equipped Event, so that may interfere with the script.
this is inside of the gui not a tool if that is what you are thinking (im making an advanced tool system)