Im making a boss battle’s game, basically i want it so that when everyone is in the lobby (not when there are remaining player’s fighting the boss) a timer gui will pop up on everyone’s screen, and will slowly go down until the second’s reaches 0, but i do not know how i can do this.
I want the timer gui to have seconds and milliseconds, (Ex. 3.45).
Also when the second’s reach 0, it will choose a random boss and teleport every player to the boss’s map
Create a simple countdown loop and variable with the amount of time you want which decreases the variable slightly every loop (add task.wait(0.05) for example, can be anytime or whatever is accurate) display the number on the GUI, repeat it until the timer is = 0 then use math.random to randomly select a boss, then teleport. It should be pretty simple.
Now there’s something that i do not know what to do, the timer text appears different on every player’s screen which is because the player is joining later than the other player, how could i fix this
only one timer should exist on the server. the server should then update a number value in replicated storage and then the clients update their text every renderstepped.
function timer(textLabel, seconds)
local startTime = os.clock()
while os.clock() - startTime <= seconds do
textLabel.Text = math.floor(os.clock() - startTime)
end
end