#it works when you turn on but it dosent turn off please help

23 messages · Page 1 of 1 (latest)

fading zodiac
#

ive been trying to get this fixed for months

crimson river
#

You gotta compare it with another brick color

fading zodiac
#

i want the animation to stop though

#

the colors work

#

i just want the animation to stop

ashen temple
#

Listen

#

You misunderstood

ashen temple
#

Here you’re checking if the background color is a string, which it will never be

#

Youve gotta check if its equal to BrickColor.new("Lime green")

fading zodiac
#

oh

#

Well it works when I turn it on but it dosent work when I turn it off

fading zodiac
#

@ashen temple

hollow summit
hollow summit
# fading zodiac ive been trying to get this fixed for months

I don't really know what you are making but, after turning it off, it the code proceeds and do stuff meant for turning it on, but by using else, you can have both actions separated.

local ui = script.Parent
local animation = script.Animation
local plr = game.Players.LocalPlayer

ui.Activated:Connect(function()
    local char = plr.Character
    local hum = char:FindFirstChildOfClass("Humanoid")
    local anim = hum:LoadAnimation(animation)

    if ui.BackgroundColor == BrickColor.new("Lime green") then
        ui.BackgroundColor = BrickColor.new("Really red")
        anim:Stop()

    else
        ui.BackgroundColor = BrickColor.new("Lime green")
        anim:Play()
        task.wait(1)
    end
end)
#

Also, please send the code in text, not in screenshot.

#

Using ` symbol (back-tick).

fading zodiac
hollow summit
#

So :Stop() is stopping another "animation" instead of the one currently playing.

#

It is just my guess though, but I would sleep soon.