What I am trying to do is make a timer in my game the same for every player. (For example, if the timer has 5 minutes left, then any new players that join’s timer will be 5 minutes.)
This is the current code for my timer.
local timer = script.Parent
local minutes = 9
local seconds = 59
repeat
if seconds <= 0 then
minutes = minutes - 1
seconds = 59
else
seconds = seconds - 1
end
if seconds <= 9 then
timer.Text = tostring(minutes)..":0"..tostring(seconds)
else
timer.Text = tostring(minutes)..":"..tostring(seconds)
end
wait(1)
until minutes <= 0 and seconds <= 0
local RemoteEvent = "idk"
RemoteEvent:FireServer(minutes, seconds)
script:
local RemoteEvent = "idk"
local function ChangeTime(minutes, seconds)
print(minutes .. ":" .. seconds)
end
RemoteEvent.OnServerEvent:Connect(ChangeTime)
Instead of sending remotes all the time. I would suggest creating a Timer “IntValue” in ReplicatedStorage, and then update that with the amount of seconds your timer is at, in a server for-loop.
On the client I would do “GetPropertyChangedSignal(“Value”)” on the IntValue in ReplicatedStorage. If value is above 0, then show the text and say something like “Value…” seconds left".