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
Is this in a LocalScript? Animations for player characters must be played from a Local Script to work. (http://wiki.roblox.com/index.php?title=Animations#Using_Animation_in_Games)
--MightyWanderer