Working on a settings menu for my game, I want an option to turn off shadows so improve performance without lowering graphics. Ive got a system but it doesn’t seem to work. it changes the buttons text but doesnt toggle the shadow. Im relatively new to scripting so sorry if this looks like a total mess :E
You are in luck!
Disable:
game:GetService("Lighting").GlobalShadows = false -- This will disable shadows completely
Enable:
game:GetService("Lighting").GlobalShadows = true -- This will enable shadows
In your code, you are on the right lines except you kinda did a mistake and instead of doing .GlobalShadows you instead saved the value as a variable which does not work.
You are basically setting a variable instead of the actual property.
So your fix should be:
lighting.GlobalShadows = false/true
Instead of:
shadows = true/false
When you “turn” a property into a variable it just gets the stored value, not the actual reference to the property, so you have to do “lighting.GlobalShadows = boolean (boolean is true/false)”
just do lighting.GlobalShadows = not lighting.GlobalShadows
