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

Decal switches anyway even though its told to switch at a certain time?

Hi I'm making a moon phasing script and I ran into a problem. I checked the output and nothing seems to be wrong with it, when really there is. I can't get the decal to switch at the time it's supposed to, instead it wants to switch every time the game opens.

Here's the script:

local c = game.Lighting
local tod = "5:45:00"
local time = game.Lighting.TimeOfDay
local todd = tod .. time

c.Sky.SunAngularSize = 6 -- these are just tests
c.Sky.MoonAngularSize = 4

if todd then
    c.Sky.MoonTextureId = "http://www.roblox.com/asset/?id=4517662278"
end

1 answer

The script is only running once because you haven't wrapped the "if" in a while true do. You must be constantly checking if the time is equal to that value.


local c = game.Lighting
local tod = "5:45:00"
local time = game.Lighting.TimeOfDay
local todd = tod .. time

c.Sky.SunAngularSize = 6 -- these are just tests
c.Sky.MoonAngularSize = 4

while true do 
	if todd then
   		 c.Sky.MoonTextureId = "http://www.roblox.com/asset/?id=4517662278"
	end
	wait()
end

1 comment

0

Still didn't fix the problem.

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