So, I want to make a TV that shows a different TV show (aka a set of decals and audio) at different times of day.
But I can't figure out how the heck I would make them appear at certain times of day! I'm guessing I would use this code:
1 | if GetMinutesAfterMidnight() = = 18 : 00 : 00 |
2 | then |
3 | --(set to a certain decal and audio) |
I know there is an error in this and I'm a bit new to scripting, so I can't figure this out. Any help is appreciated :)
Problem 1:
The ':' operator cannot be in a number value.
And if it did use ':', it would be a string.
Problem 2:
Like what Sublimus said in the comments, the returned value that you want would be 1080.
Problem 3:
GetMinutesAfterMidnight()
is a method, not a global function, so you need to call it like this:
game.Lighting:GetMinutesAfterMidnight()
Now, to actually make something happen after it returned true, you would put the code in the if statement, like so:
1 | while wait( 60 ) do -- repeats every minute, change this to how long your minutes are, in game. Most scripts add a minute a second or the like, so it would be wait(1) |
2 | if game.Lighting:GetMinutesAfterMidnight = = 1080 then |
3 | -- code |
4 | end |
5 | end |
I put the while loop in there because if statements only run once.