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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by
Ruves 21
5 years ago
Edited 5 years ago

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
0
Still didn't fix the problem. Hwk3rAlt 14 — 5y
Ad

Answer this question