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?
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
wait(f)