Best way to make a synchronized count down?

I have a countdown which I want to try and have synced as close as possible from player - player

Right now the server will pretty much tell the client “the countdown is going to begin” then afterwards the client will countdown on their own

I had the idea of the server telling the client each number as well, but firing client 8+ times seems wrong lol.

Anyone have any ideas or solutions for this?

Can you show us a script to see what you are doing that’s causing that

What’s wrong with firing the client 8+ times? Either way you can avoid using remote events entirely by simply storing an IntValue in replicated storage and modifying its value from the server then all the clients have to do is keep track of the value.

1 Like

Sure thing,

This is the server script, just fires clients and then

Events.MatchInfo:FireClient(game.Players[tostring(Player1)], tostring(Player2), tostring(PickedMap))
Events.MatchInfo:FireClient(game.Players[tostring(Player2)], tostring(Player1), tostring(PickedMap))

then client.

Events.MatchInfo.OnClientEvent:Connect(function(challenger, MapUsed)
frame.Text = "3"
wait(1)
frame.Text = "2"
wait(1)
frame.Text = "1"
wait(1)
frame.Text = "Begin"
end)
1 Like

Ah I was thinking about having a Value, but then thought it may get messy as I’d need it to create a new value then later delete it and repeat

As for firing clients, I thought it may’ve caused the server some issues? I’ve heard that could happen, not 100% sure though

Are you using the player’s gui to change the text?

Yep the client changes the text

1 Like

Wait I am still confused on what you are trying to do.

A countdown which is some what synchronized on clients
The current way I am using would de-synchronize

Why would you need to create a new value? You could just change the value, and then make a loop that makes the text equal the value over and over again.

1 Like

Well there’s going to have multiple countdowns, which will need to only be shown on certain screens at certain times, although now that I think about it, I can still pre-make them as there can only have X amount of countdowns at a time, just in the future when serversize changes I’d need to add more.

Do you think this will keep it more in-sync this way?

As some people have mentioned earlier, you can use either a Number/IntValue inside ReplicatedStorage & with the .Changed event, you can pretty much replicate it to all clients

Say I put 1 script inside the server that will handle the countdown changes:

local Countdown = game.ReplicatedStorage:WaitForChild("Countdown")

for Loop = 1, 60 do
    Countdown.Value -= 1
    wait(1)
end

And on the local-side, you can put this in a LocalScript where you want the text to change:

local Countdown = game.ReplicatedStorage:WaitForChild("Countdown")
local TextLabel = script.Parent.TextLabel

Countdown.Changed:Connect(function(ChangedValue)
    TextLabel.Text = ChangedValue
end)

The .Changed Event will listen for any changes made to the Value made by the server/client

Reference:

3 Likes

Sorry to bump, but I really really needed this. Will help me in enormous ways. Will include ur name in credits. Thank you so much sir :pray:

2 Likes