I’ve tried doing this at least 10 times now, and I’m about ready too give up. All I want it to do is add to the in-game time. And when it reaches 14 reset back to 12.
The value stays on 12, however.
Two things to note: I am aware there is no wait() in there. But it’s literally 3:30am and I’m not going to bother fixing it right now.
And 1 is a test value to see if it works quickly. The real value will be lower.
What’s going wrong? I’m just irritated with it now.
That’s because you are using ClockTime as the value for the variable name Time. What you are doing is something like this:
local object = { Value = 0 }
local objectValue = object.Value
objectValue += 1
Printing the result of object.Value will still be 0, because objectValue is separate from object.Value all it did was copy the data from it; it should be object.Value += 1 and disregard the objectValue variable. In your case you need to do this:
local parent = script.Parent
while task.wait(0.1) do
parent.ClockTime += 1
end
Still, this method is not the proper way to create a day-night cycle. There should already be a lot of tutorials on the internet; just search “day and night cycle Roblox.”