How to make a gui live

Every roblox player has there own screen and its different. I am trying to get a timer like piggy were when you join the game it says it live time. How do i do this. I might be unclear.
So Every player has there own gui. But there are some problems. Every player does not see the same thing.

I have no solution.

-- script.Parent.Text = ("Round Starts in 20")
wait(1)
script.Parent.Text = ("Round Starts in 19")
wait(1)
script.Parent.Text = ("Round Starts in 18")
wait(1)
script.Parent.Text = ("Round Starts in 17")
wait(1)
script.Parent.Text = ("Round Starts in 16")
wait(1)
script.Parent.Text = ("Round Starts in 15")
wait(1)
script.Parent.Text = ("Round Starts in 14")
wait(1)
script.Parent.Text = ("Round Starts in 13")
wait(1)
script.Parent.Text = ("Round Starts in 12")
wait(1)
script.Parent.Text = ("Round Starts in 11")
wait(1)
script.Parent.Text = ("Round Starts in 10")
wait(1)
script.Parent.Text = ("Round Starts in 9")
wait(1)
script.Parent.Text = ("Round Starts in 8")
wait(1)
script.Parent.Text = ("Round Starts in 7")
wait(1)
script.Parent.Text = ("Round Starts in 6")
wait(1)
script.Parent.Text = ("Round Starts in 5")
wait(1)
script.Parent.Text = ("Round Starts in 4")
wait(1)
script.Parent.Text = ("Round Starts in 3")
wait(1)
script.Parent.Text = ("Round Starts in 2")
wait(1)
script.Parent.Text = ("Round Starts in 1")
wait(1)
script.Parent.Text = ("Round Starts in 0")
wait(1)
script.Parent.Text = ("Round Starts in 0")
wait(1)
script.Parent.Text = ("Round Starts in 0")

It is just i can not force every player to have the same countdown at the same time. Like if a player joined five seconds after the last player joined the time would be incorrect. The countdown would be five seconds late.

You see. The player on the right joined three seconds after the player on the left joined.

2 Likes

Use the server to fire all clients the new countdown timer number and then when the clients receive the event, they change the text to the new number that the server provided as a countdown, or you can have the server call all clients to initiate the countdowns by themselves.

remoteEvent:FireAllClients(newNumber)

2 Likes

Or you could use a string/int value in the ReplicatedStorage and use this code to change the text to that:

game.ReplicatedStorage.TimeVal:GetPropertyChangedSignal("Value"):Connect(funtion()
    script.Parent.Text = game.ReplicateStorage.TimeVal.Value
end

With this method you would have to handle the TimeVal’s value on the server so you would need this on a server script:

while wait(1) do
    if game.ReplicatedStorage.TimeVal ~= 0 or (some other way of telling if a game is in progress) then
        game.ReplicatedStorage.TimeVal = game.ReplicatedStorage.TimeVal-1
    end
end

On the server, you would want to have a script that is handling the countdown, and a RemoteEvent that woulduse the :FireAllClients() method to the Clients.

From the Server:

for i = 20,0,-1 do --Start at 20, End at 0, -1 each time
    wait(1)
    RemoteEvent:FireAllClients("TimeLeft", i)
end

In Client Script:

RemoteEvent.OnClientEvent:Connect(function(Cmd, Arg)
    if Cmd == "TimeLeft" then
        TextLabel.Text = "Round starts in: " .. tostring(Arg) .. " seconds!"
    end
end)

Hope you find this helpful!

EDIT: Not sure why it replied to NeonD00m’s post, that was not intended.

2 Likes

I’m trying it.(30 characters…)

While that would work, I think the remote event approach is better in my opinion, it’s all up to you!

It would actually error.
[30 char]

game.ReplicatedStorage* (30 Characters)

1 Like