What's the best way of changing UI on all clients?

Hey!
I’m attempting to make a timer UI and I can’t find a stable method of it. The best one was firing all clients then a LocalScript for each player repeats it the amount of the timer, and event this was barley stable.

1 Like

How about using a RemoteEvent on the server side (like the Workspace), having each client connect to its OnClientEvent, and then firing it when you need to?

1 Like

I already tried that, it’s extremely unstable (Sometimes there off time, sometimes just don’t work)

1 Like

They you just can try to fire all clients.

1 Like

I have already tried RemoteEvents, as I said, they rarely perfectly work.

1 Like

I mean, can you really do anything about lag anyways? I don’t think there’s a better option than just using RemoteEvents

I don’t think there’s an alternative for server-client communication. Can you post the script? Maybe there’s a way for someone here to optimize it.

1 Like

I don’t have the exact one, but it went along like this:
Server

local event = game.ReplicatedStorage.TimerStart
local timerLength = 15
event:FireAllClients(timerLength)

Client (All clients receive this)

local event = game.ReplicatedStorage.TimerStart
local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui

event.OnClientEvent:Connect(function(length)
for i = length, 0, -1 do
playerGui.Timer.TimerText.Text = tostring(i)
task.wait(1)
end
end)
1 Like
local replicated = game:GetService("ReplicatedStorage")
local event = replicated:WaitForChild("TimerStart")
local timerLabel = script.Parent

event.OnClientEvent:Connect(function(length)
	for i = length, 0, -1 do
		timerLabel.Text = tostring(i)
		task.wait(1)
	end
end)

Local scripts can be placed inside of ScreenGui instances, specifically, inside of the GuiObject that you want the script to manipulate instead of needing to index the player’s “PlayerGui” folder each time you want to manipulate one of the player’s guis.

Yes, that’s what I did before. It’s unreliable at least for me.

1 Like