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 8 years ago

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

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

2 answers

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
8 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

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

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 — 8y
Ad
Log in to vote
0
Answered by
Suamy 68
8 years ago
local l = game.ServerStorage.Stuff:Clone()
while true do
        wait()
        if game.Lighting.TimeOfDay=="1:00:00" then

        l.Parent=game.Workspace
    end
end

Try that!

0
Doesn't work for some reason am I doing something wrong? rareheaddress 74 — 8y
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 — 8y

Answer this question