I'm try making daytime changing script, but it didn't work, this is my script.
while true do
game.Lightning.TimeOfDay = game.Lightning.TimeOfDay + "01:00:00"
wait(1)
end
Thx
I'm try making daytime changing script, but it didn't work, this is my script.
while true do
game.Lightning.TimeOfDay = game.Lightning.TimeOfDay + "01:00:00"
wait(1)
end
Thx
The issue is,you are trying to perform an arithmetic operation on a string value.Also,you made a common typo mistake in your code:"Lightning".
You would need to assign a number variable to store the value of the current time,then convert it into a string.
Here is an example script of what I'm talking about:
Minutes=0
Hours=0
TimeString=""
while true do
Minutes=Minutes+10
if Minutes>=60 then
Minutes=0
Hours=Hours+1
end
if Hours>24 then Hours=0 end
game.Lighting.TimeOfDay=tostring(Hours)..":"..tostring(Minutes)..":00"
wait(1)
end
I hope this helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.
12 comments
My original post that I deleted earlier was a mistake and confusion on my end,I apologize.
thx you got right answer
Mind upvoting my post?
Good job. Sure was faster then how I was going to explain it. Also, makes much more sense.... I was just gonna use a for loop.
Thanks! I've been programming for a long time. Also,king,timeofday is a formatted string value,not a number value. :)
^ I know that however, my for loop worked. I just set it equal to '1' or '2' or whatever it was.... It automatically sets the hours to 0 when they reach 24.
But, I never took into account the minutes because his question didn't have a delta minutes to begin with...
Ah.
Your code could be a bit neater though for reading purposes xD. Spaces would be cool.
Sorry,I am doing 9 things at once.Also trying to help a lot of people here,lol.
Nah man, it's all cool. I respect that you trying to help the community out though that's nice of you. Keep up the great work :D
You to bud!