Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't this time of day thing working?

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

✓ Accepted answer

##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.

1 comment

0

Thanks.

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!

2 comments

0

Doesn't work for some reason am I doing something wrong?

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.