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

Does anyone know how to fix this script?

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

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

1 comment

0

Actually, TimeOfDay is a string value.

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