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

Why isn't this working?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
                    if i == 20 then
                                                for i,v in pairs(players) do   
                                                        coroutine.wrap(function()      
                                                                v:WaitForChild("PlayerGui")
                                                                p = 5
                                                                for z = 1,130 do
                                                                        v.PlayerGui.title.TextLabel.BackgroundColor3 =          Color3.new(255,z,0)                                                        
                                                                        wait(.1)
                                                                end
                                                        end)() 
                                                end
                                        end    
                                wait(p)
                                if i == 20 then
                                        for i,v in pairs(players) do   
                                                coroutine.wrap(function()      
                                                        v:WaitForChild("PlayerGui")
                                                        p = 5
                                                        for z = 1,130 do
                                                                q = 130 - z
                                                                v.PlayerGui.title.TextLabel.BackgroundColor3 = Color3.new(255,q,0)
                                                                wait(.1)
                                                        end
                                                end)() 
                                        end
                                        table.insert(Cops,players[playerShown]) removeTable(players,players[playerShown])
                                end

having some issues with this code, I want the GUI to turn red>orange slowly then 5 seconds later orange>red slowly but the GUI goes from red to yellow INSTANTLY then 10 seconds later goes from yellow to red INSTANTLY

any errors you can see? output is clean

what am I doing wrong?

0
Color3 red, green and blue values must be between 0 and 1. Divide your values by 255 and your code should function correctly. Articulating 1335 — 10y
0
Thankyou! Will give it a shot and post results. crackabottle123 110 — 10y

1 answer

Log in to vote
1
Answered by
Tkdriverx 514 Moderation Voter
10 years ago

This is the fix, visually, for those who want to see it:

if i == 20 then
    for i, v in pairs(players) do   
        coroutine.wrap(function()      
        v:WaitForChild("PlayerGui")
        p = 5

        for z = 1,130 do
            v.PlayerGui.title.TextLabel.BackgroundColor3 = Color3.new(1, z / 255, 0)                                                        
            wait(0.1)
        end
        end)() 
    end
end    

wait(p)

if i == 20 then
    for i, v in pairs(players) do   
        coroutine.wrap(function()      
            v:WaitForChild("PlayerGui")
            p = 5

            for z = 1,130 do
                q = 130 - z
                v.PlayerGui.title.TextLabel.BackgroundColor3 = Color3.new(1, q / 255, 0)
                wait(0.1)
            end
        end)()
    end

    table.insert(Cops,players[playerShown]) removeTable(players,players[playerShown])
end
0
Thankyou for this, I have done exactly that. crackabottle123 110 — 10y
Ad

Answer this question