My Frame isn't Updating that fast

Hi everyone, hope you have a nice day!

So i was scripting kinda like “round system” it basically change colors every 6 seconds and it show on the frame that color (For e.g, if the script choosed red in the color table, so it shows red in the playerGUI)

But for some reason , it doesn’t really get updated that fast
Here is the Server Script thats in ServerScriptService:

local remoteEvent = game.ReplicatedStorage:FindFirstChild("UpdateFrameColor")
local frame = game.StarterGui.RoundGUI.RoundColor

local colors = {
	Color3.fromRGB(255, 0, 0), -- Red
	Color3.fromRGB(255, 255, 0), -- Yellow
	Color3.fromRGB(255, 176, 0), -- Orange
	Color3.fromRGB(0, 255, 0), -- Lime
	Color3.fromRGB(0, 0, 255), -- Blue
	Color3.fromRGB(170, 0, 170), -- Magenta or lilac
	Color3.fromRGB(255, 0, 191) -- Pink
}

while true do
	local selectedColor = colors[math.random(1,#colors)]
	remoteEvent:FireAllClients(selectedColor) 

	local stairs = game.Workspace.Stairs:GetChildren()

	local nonMatchingStairs = {}
	for _, stair in pairs(stairs) do
		if stair.Color ~= selectedColor then
			table.insert(nonMatchingStairs, stair)
		end
	end

	if #nonMatchingStairs > 0 then
		for _, stair in pairs(nonMatchingStairs) do
			stair.Transparency = 1
		end

		wait(2)

		for _, stair in pairs(nonMatchingStairs) do
			stair.Transparency = 0
		end

		wait(6)
	end
end

And here is the Local script that’s in StarterGUI

local remoteEvent = game.ReplicatedStorage:FindFirstChild("UpdateFrameColor") 
local player = game.Players.LocalPlayer

local function onUpdateFrameColor(selectedColor)
	wait(2) 

	local playerGui = player:WaitForChild("PlayerGui")
	local frame = playerGui.RoundGUI.RoundColor
	frame.BackgroundColor3 = selectedColor
end
remoteEvent.OnClientEvent:Connect(onUpdateFrameColor)

The picture:

and that’s what it shows:

3 Likes

anyone knows what is the solution?

1 Like

You have a wait(2) break in the middle of the script, I think it is that little bit that screws it over

There is 2 wait(2), do you mean the server script or the local script?

1 Like

I was refering to the Server Script, since there seem to be a 2 second break before the platforms generate

1 Like
local remoteEvent = game.ReplicatedStorage:FindFirstChild("UpdateFrameColor")
local frame = game.StarterGui.RoundGUI.RoundColor

local colors = {
	Color3.fromRGB(255, 0, 0), -- Red
	Color3.fromRGB(255, 255, 0), -- Yellow
	Color3.fromRGB(255, 176, 0), -- Orange
	Color3.fromRGB(0, 255, 0), -- Lime
	Color3.fromRGB(0, 0, 255), -- Blue
	Color3.fromRGB(170, 0, 170), -- Magenta or lilac
	Color3.fromRGB(255, 0, 191) -- Pink
}

while wait(6) do
	local selectedColor = colors[math.random(1,#colors)]
	remoteEvent:FireAllClients(selectedColor) 

	local stairs = game.Workspace.Stairs:GetChildren()

	local nonMatchingStairs = {}
	for _, stair in pairs(stairs) do
		if stair.Color ~= selectedColor then
			table.insert(nonMatchingStairs, stair)
		end
	end

	if #nonMatchingStairs > 0 then
		for _, stair in pairs(nonMatchingStairs) do
			stair.Transparency = 1
			wait(2)
			stair.Transparency = 0
		end
	end
end
local remoteEvent = game.ReplicatedStorage:FindFirstChild("UpdateFrameColor") 
local player = game.Players.LocalPlayer

local function onUpdateFrameColor(selectedColor)
	local playerGui = player:WaitForChild("PlayerGui")
	local frame = playerGui.RoundGUI.RoundColor
	frame.BackgroundColor3 = selectedColor
end
remoteEvent.OnClientEvent:Connect(onUpdateFrameColor)
1 Like

oh, my explanation is really bad
i meant i want the frame to be changed when the script pick the color from the table

1 Like