You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
When you press a button shadows will turn on/off.
What is the issue? Include screenshots / videos if possible!
The shadow’s won’t turn on or off when pressing the button.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried so far looking it up on the web. Only found a dev post but it looks like the same thing as mine. Not sure what to do.
local GlobalShadows = game.Lighting.GlobalShadows
local DisabledShadowButton = script.Parent.Shadows.DisableShadows
local EnableShadowsButton = script.Parent.Shadows.EnableShadows
DisabledShadowButton.MouseButton1Click:Connect(function()
GlobalShadows = false
end)
EnableShadowsButton.MouseButton1Click:Connect(function()
GlobalShadows = true
end)
Just checked, you should be able to set Global shadows to false using that.
Your issue is that you’re defining your variable GlobalShadows as the direct value of “GlobalShadows” under lighting, which is either a true or false value, you’re not defining it.
Try to directly set game.Lighting.GlobalShadows instead.
No, this script is not the same, this time I declared a variable for lighting and changed the GlobalShadows property. OP’s script got the value of the GlobalShadows property in the first line.