Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't this working?

 					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?

2 comments

0

Color3 red, green and blue values must be between 0 and 1. Divide your values by 255 and your code should function correctly.

0

Thankyou! Will give it a shot and post results.

1 answer

✓ Accepted answer

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

1 comment

0

Thankyou for this, I have done exactly that.

This discussion is preserved as it was. New answers, comments, and votes are closed.