I am making a Christmas update for my game that every 10 minutes it triggers a present rain event. But when I try testing the countdown script, everything works but each second feels like 3 seconds or even more.
I have no idea why this is happening since I was able to make a server-sided countdown script in the past without this ever happening.
I have been trying to fix this for a while now and I’ve made no progress at all. Even if I set the increment to 0.01 it still feels too long.
Script (Server):
local eventfolder = workspace:WaitForChild("ChristmasEvent")
local music = workspace:WaitForChild("ServerSounds").Music.ChristmasEvent
local defaultminutes = 0
local defaultseconds = 10
local defaultminutes2 = 1
local defaultseconds2 = 5
local secondincrement = 0
local minutes = eventfolder.Minutes
local seconds = eventfolder.Seconds
local eventbool = eventfolder.Event
seconds.Value = defaultseconds
minutes.Value = defaultminutes
eventbool.Changed:Connect(function()
if eventbool.Value == true then
music.Playing = true
else
music:Stop()
end
end)
while true do
eventbool.Value = false
seconds.Value = defaultseconds
minutes.Value = defaultminutes
seconds.Value -= 1
repeat
wait(secondincrement)
print("tick")
print(seconds.Value)
print(minutes.Value)
seconds.Value -= 1
if seconds.Value < 0 then
seconds.Value = 59
minutes.Value -=1
end
until minutes.Value <= 0 and seconds.Value <= 0
seconds.Value = defaultseconds2
minutes.Value = defaultminutes2
eventbool.Value = true
repeat
wait(secondincrement)
print("tick")
print(seconds.Value)
print(minutes.Value)
seconds.Value -= 1
if seconds.Value < 0 then
seconds.Value = 59
minutes.Value -=1
end
until minutes.Value <= 0 and seconds.Value <= 0
end