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

(SOLVED) How do i make this 2D animation on a BillboardGUI stop?

Asked by 4 years ago
Edited 4 years ago

In my game there is a skin that is 2D, there is a script inside of a billboardGUI that is used to make it have a walk animation, what ends up happening is that the animation doesn't stop.

Here is the code i wrote:

    script.Parent.Parent.Parent.Humanoid.Running:Connect(function(speed)
        if speed > 0 then
            repeat
            script.Parent.ImageLabel.Image = "http://www.roblox.com/asset/?id=5515572147"
            wait(0.2)
            script.Parent.ImageLabel.Image = "http://www.roblox.com/asset/?id=5515572767"
            wait(0.2)
        until speed < 1
        else
            script.Parent.ImageLabel.Image = "http://www.roblox.com/asset/?id=5515571488"
        end
    end)

FIXED CODE:

local running = false

script.Parent.Parent.Parent.Humanoid.Running:Connect(function(speed)
    if speed > 0 then
        running = true
    else
        running = false
    end
end)

while true do
    if running == true then
        script.Parent.ImageLabel.Image = "http://www.roblox.com/asset/?id=5515572147"
        wait(0.2)
        script.Parent.ImageLabel.Image = "http://www.roblox.com/asset/?id=5515572767"
        wait(0.1)
    else
        script.Parent.ImageLabel.Image = "http://www.roblox.com/asset/?id=5515571488"
    end
    wait(0.1)
end
0
i forgot to mention that the builboardGUI is put inside of the player's HumanoidRootPart. TheEnderG 7 — 4y

Answer this question