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

Not all colour are changing at the same time,why?

Hello Scripters :D , i have created a part that when u touch the switch you change the colour of 12 part in a folder and 12 parts in another folder ,so i use this this script:

Changer = script.Parent
local t=0
local f = 0
Changer.ClickDetector.MouseClick:Connect (function()

while true do
for _, Green in pairs(workspace.Game.Lobby.Structure.WindowFrame:GetChildren()) do
	Green.BrickColor = BrickColor.new("Really red")
	wait(f)
end
for _, Green in pairs(workspace.Game.Lobby.Structure.YellowMarks:GetChildren()) do
	Green.BrickColor = BrickColor.new("Really red")
	wait(f)
end
wait(t)

	for _, Green in pairs(workspace.Game.Lobby.Structure.WindowFrame:GetChildren()) do
		Green.BrickColor = BrickColor.new("Deep orange")
		wait(f)
end
for _, Green in pairs(workspace.Game.Lobby.Structure.YellowMarks:GetChildren()) do
	Green.BrickColor = BrickColor.new("Deep orange")
	wait(f)
end ..................

the problem is, that when i click the switch, the parts change the colour,but not instantly... like all wait is set to 0,why it doesent do that instantly?

1 answer

✓ Accepted answer

it doesnt do that instantly because

wait(0)

is the same with wait 0.03 seconds, because that is the minimum the wait can do

if you want to do it instantly, try making all wait(f) like this

if f ~= 0 then
    wait(f)
end

this means

  • if f is zero it will do nothing (no wait)
  • if f is not zero it will do wait(f)

1 comment

0

your right, thanks.

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