You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
My module script does not seem to be able to change the RunSpeed variable for some reason. -
What is the issue? Include screenshots / videos if possible!
This is what i tried to do ↓
Expected output:
Time: 12:3:43
Run speed: 2 -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I searched a lot of documents, but I still found nothing.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this is lua code
local Lighting = game.Lighting
local RunSpeed = 0
local Clock = {
Hour = 12,
Minute = 0,
Second = 0,
}
function ClockMain()
Clock.Second += 1
if Clock.Second == 60 then
Clock.Second = 0
Clock.Minute += 1
end
if Clock.Minute == 60 then
Clock.Minute = 0
Clock.Hour += 1
end
if Clock.Hour == 24 then
Clock.Hour = 0
end
end
function WhileLoop()
coroutine.wrap(function()
while true do
wait(RunSpeed + 1)
ClockMain()
print("Time: " .. Clock.Hour .. ":" .. Clock.Minute .. ":" .. Clock.Second)
print("Run speed: " .. RunSpeed)
Lighting.TimeOfDay = Clock.Hour .. ":" .. Clock.Minute .. ":" .. Clock.Second
end
end)()
end
local Main = {
Main = function()
WhileLoop()
end,
SetWorldTime = function(Time)
end,
SetWorldTimeRunningSpeed = function(Speed)
RunSpeed = Speed <-- This
end,
}
return Main
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.