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

Does anyone know how to fix this script?

Asked by 10 years ago
ambient = game.Lighting.Ambient 
outdoorAmbient = game.Lighting.OutdoorAmbient 
timeOfDay = game.Lighting.TimeOfDay

if timeOfday >= 18:00:00 and <= 06:00:00 then 
ambient = 0,0,0 
outdoorAmbient = 0,0,0 
end

The output give me this: 09:24:18.273 - Workspace.Script:5: 'then' expected near ':'

I have no idea what this means, I would really appreciate it if someone explained this to me.

1 answer

Log in to vote
0
Answered by 10 years ago

Please upvote my rep and/or mark this as the correct answer if this helped you or solved your question.

I can't really explain the problem but here's the basic version of it: You can't use : because thats where the number ends. To fix the error simply replace the : with a ., making it a decimal.

Fixed version:

ambient = game.Lighting.Ambient 
outdoorAmbient = game.Lighting.OutdoorAmbient 
timeOfDay = game.Lighting.TimeOfDay

if timeOfday >= 18.00.00 and <= 06.00.00 then 
ambient = 0,0,0 
outdoorAmbient = 0,0,0 
end

-- Edit -- If that doesn't work its because ambient is set to the value of game.Lighting.Ambient's. If it doesn't work, use this:

timeOfDay = game.Lighting.TimeOfDay

if timeOfday >= 18.00.00 and <= 06.00.00 then 
game.Lighting.Ambient = 0,0,0 
 game.Lighting.OutdoorAmbient = 0,0,0 
end
0
Actually, TimeOfDay is a string value. GoldenPhysics 474 — 10y
Ad

Answer this question