Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't this time of day thing working?

Asked by 9 years ago

I'm not sure what's wrong It seems fine but nope it ain't work.

1while true do
2        wait()
3        if game.Lighting.TimeOfDay=="1:00:00" then
4        local l = game.ServerStorage.Stuff:Clone()
5        l.Parent=game.Workspace
6    end
7end

2 answers

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

Solution

Though I do not know exactly how your script is changing times, I would always recommend using GetMinutesAfterMidnight and compare it with a number. I would also recommend for efficiency purposes, to change the while true do to a .Changed event. Having too many while loops may lead to lag in your game with too many of them.


Final Script

1game.Lighting.Changed:connect(function()
2    if game.Lighting:GetMinutesAfterMidnight() == (60) then --Sixty minues in an hour right? 1:00?
3        local Objects = game.ServerStorage.Stuff:Clone()
4        Objects.Parent = game.Workspace
5    end
6end)

Hopefully this answered your question, if so do not forget to hit the Accept Answer button. If you have any questions feel free to comment below. If you experience any errors, please check the Developer Console or Output depending on your testing environment and tell us what the issue is so we may assist you further.
0
Thanks. rareheaddress 74 — 9y
Ad
Log in to vote
0
Answered by
Suamy 68
9 years ago
1local l = game.ServerStorage.Stuff:Clone()
2while true do
3        wait()
4        if game.Lighting.TimeOfDay=="1:00:00" then
5 
6        l.Parent=game.Workspace
7    end
8end

Try that!

0
Doesn't work for some reason am I doing something wrong? rareheaddress 74 — 9y
0
This script might end up breaking even more, because once the model "Stuff" has been placed in Workspace, if that model were to be completely removed it'd error saying nil value. M39a9am3R 3210 — 9y

Answer this question