I have made these three scripts, one randomly generates rooms that reset every 600-seconds (10 minutes), another script that displays a 600-second timer that resets once it reaches 0, and another that is in StarterGui under text label. I was wondering if it is possible to sync the timer that is seen on the player's screen with the timer that controls the resetting of the rooms. I want the timer to run out and at the same time the rooms to reset.
The script that generates rooms; (script is in SeverScriptService)
local rooms = Instance.new("Folder")
rooms.Name = "Rooms"
rooms.Parent = workspace
local timer = 600
while true do
rooms:ClearAllChildren()
local rooms = game.ReplicatedStorage:WaitForChild("GeneratedRooms"):GetChildren()
for I, placeHolder in pairs(game.Workspace.PlaceHolders:GetChildren()) do
local chosenRoom = rooms[math.random(1,#rooms)]:Clone()
chosenRoom.PrimaryPart = chosenPart.Floor
chosenRoom:SetPrimaryPartCFrame(placeHolder.CFrame)
chosenRoom.Parent = game.Workspace
end
wait(timer)
end
The scripts that displays the timer on the player's screen; (Script is in ServerScriptService)
local rep = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local minutesvalue = rep:WaitForChild("Minutes")
local secondsvalue = rep:WaitForChild("Seconds")
local minutes = 10
local seconds = 0
while true do
minutesvalue.Value = minute
secondsvalue.Value = seconds
repeat
if secondsvalue.Value <=0 then
minutesvalue.Value = minutesvalue.Value -1
secondsvalue.Value = 59
else
secondsvalue.Value = secondsvalue.Value -1
end
wait(1)
until secondsvalue.Valiue <=0 and minutesvalue.Value <=0
end
(Script is in StarterGui - ScreenGui - Text label. And is a localscript)
local rep = game:GetService("ReplicatedStorage")
local minutes = rep:WaitForChild("Minutes")
local seconds = rep:WaitForChild("Seconds")
local text = script.Parent
if seconds.Value <= 9 then
text.Text = tostring(minutes.Value)..":0"..tostring(seconds.Value)
else
text.Text = tostring(minutes.Value)..":"..tostring(seconds.Value)
end
minutes:GetPropertyChangedSignal("Value"):Connect(function()
if seconds.Value <= 9 then
text.Text = tostring(minutes.Value)..":0"..tostring(seconds.Value)
else
text.Text = tostring(minutes.Value)..":"..tostring(seconds.Value)
end
end)
seconds:GetPropertChangedSignal("Value"):Connect(function()
if seconds.Value <= 9 then
text.Text = tostring(minutes.Value)..":0"..tostring(seconds.Value)
else
text.Text = tostring(minutes.Value)..":"..tostring(seconds.Value)
end
end)
All scripts work on their own but are not in sync with each other. Thank you for your help!

11 comments
I edited my comment to illustrate where they go better
Whoops just realised I forgot a script inside the text label.
I just update it with the script that I forgot
From what I can gather you just want to create a timer for 600 seconds to create the rooms, and show the player the timer, but in seconds and minutes? If so I can show you that without the need for that long third script.
Yeah that is exactly what I'm going for, it would be amazing if you could show me.
Updated the second block of code in my post that will convert the timer into HMS. Analyze the code and learn from them. Both should work as long as you place them in the right scripts.
and remember, you dont need to convert the timer itself, just what is shown to the player. The conversion doesn't take place until it is time to set the guis.Text
thanks!
In the first code, on line 22, the second 'chosenPart' has a blue line under it and in the localscript on line 8 'gui' has a blue line under it.
On line 22 you defined chosenPart. Im not sure what it was for, but you didnt include it in your post. Line 8 of the second code, define gui by doing local gui = //PathToGui
Looking at it, it looks like on line 22 it should be chosenRoom.PrimaryPart = chosenRoom.Floor