In workspace, make a script that has "StringValue" module and change the module name to serverTimer
game.Workspace.Script.serverTimer
This is the code you need for the script:
timer = script.serverTimer
local seconds = 100
repeat
timer.Value = "There are " .. seconds .. " seconds left"
wait(1)
seconds = seconds - 1
until seconds == -1
In StarterGui, make a ScreenGui that has a TextLabel inside it. Inside the TextLabel, add a local script
game.StarterGui.ScreenGui.TextLabel.LocalScript
This is the code for the local script:
game.Workspace.serverScript.serverTimer.Changed:Connect(function()
script.Parent.Text = game.Workspace.serverScript.serverTimer.Value
end)
This works without causing any issues on the server side and the client side because the "StringValue" module is the middle man. Basically the server script changes the value of the "StringValue" module and the local script updates the player's text every time the module is changed. Let me know if you have any questions
EDIT:
You can make changes to the server script and by changing the code into a function:
function createAnouncer(message, timer)
if (timer == 0) then
script.ServerTimer.Value = message
wait(4)
return 0
end
repeat
local sec = " seconds"
if (timer == 1) then
sec = " second"
end
script.ServerTimer.Value = message .. timer .. sec
wait(1)
timer = timer - 1
until timer <= -1
end
createAnouncer("Intermission for ", 20)
createAnouncer("Choosing map...", 0)
createAnouncer("Choosing monster...", 0)
createAnouncer("Starting game...", 0)
createAnouncer("Survive for ", 150)
createAnouncer("Time has ended! ", 0)
10 comments
Do you have error?
There are no errors.
Actually when the server counts it down and the players join,the countdown for the players get stuck at the number the server was counting when the players joined.
Is there a way to fix this or I'm just gonna give up?
This is messed up, I tried it ._.
And when I tried it from the roblox client with 2 players,it got stuck at 15
Yep, you can try a yt video though,
No, youtube videos are garbage. They are almost never at your learning pace and the code is poor quality, and there known for misinformation
Well,it sounds cool on paper,but in practice,not really,and it is easier just to give up and never try again.
And by the way,if you're wonder about the Players.Value,it is an IntValue I made and that adds 1 to it when a players joins,and removes 1 if a player leaves.