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

Why won't the lighting brightness change with my script?

It says it all in the title. No errors in the output when I run the script

-- Made by Cakeymasterluke

local brightness  = game.Lighting.Brightness

while true do
	wait(3)
	brightness = 1.9
	wait(.125)
	brightness = 1.8
	wait(.125)
	brightness = 1.7
	wait(.125)
	brightness = 1.6
	wait(.125)
	brightness = 1.5
	wait(.125)
	brightness = 1.4
	wait(.125)
	brightness = 1.3
	wait(.125)
	brightness = 1.2
	wait(.125)
	brightness = 1.1
	wait(.125)
	brightness = 1
end

1 answer

✓ Accepted answer

Brightness is a property of Lighting (a UserData object), not an object itself, so you can't make a Lua variable reference to it. Your script is reading game.Lighting.Brightness into the variable brightness, but then only the variable's value ever gets changed, never the property of Lighting.

If you just replace brightness with game.Lighting.Brightness everywhere you set it, you will see it change. You can also make a variable reference to game.Lighting, just not to one of its properties.

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