Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i run an animation in a while loop?

Asked by
Teeter11 281 Moderation Voter
10 years ago

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

0
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. Shawnyg 4330 — 10y
0
this is inside of the gui not a tool if that is what you are thinking (im making an advanced tool system) Teeter11 281 — 10y

1 answer

Log in to vote
-1
Answered by 10 years ago

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

0
Yes it is Teeter11 281 — 10y
0
Are there any errors, then? MightyWanderer 30 — 10y
Ad

Answer this question