What I'm trying to do is get the game time to increase, but it runs really fast, and I'm unsure of how to make it slower.
local start,starthour = tick(),game.Lighting:GetMinutesAfterMidnight() game:service('RunService').Stepped:connect(function() local secs = tick()-start game.Lighting:SetMinutesAfterMidnight(secs+starthour) end)
local start, starthour = tick(), game.Lighting:GetMinutesAfterMidnight() -- Tweak this to control the speed local speedModifier = 0.5 -- I recommend keeping serperate variable for day/night time local gameTime = 0 -- When it comes to Stepped and RenderStepped it's recommended to use the event in setup like this, otherwise the 'connect' function will create new Lua threads every time event is called, which is not nice while true do -- If you know the time that has passed since the last function call, you can easily change the 'virtual time'(which would be the gameTime variable) local time, delta = game:service('RunService').Stepped:wait() -- Without the speed modifier, gameTime would show actual passed seconds since script began, but now you can alter how quickly this time will pass gameTime = gameTime + delta * speedModifier game.Lighting:SetMinutesAfterMidnight( gameTime + starthour) end
Edit: Forgot that stepped already provides delta(thank you BlueTaslem). Updated script