Hello, im trying to create a settings UI where you can turn shadows off or on.
I created a script so that when you click on the toggle shadows button, it will check to see if shadows are on, if so, they will turn off, etc.
I haven’t found the problem to why this isn’t working but I’ve tried different ways to turn the global shadows off.
game.Lighting.GlobalShadows = false
game.Lighting.GlobalShadows.Visible = false
game.Lighting.GlobalShadows.Enabled = false
I’ve tried all these but they aren’t working.
local GUI = script.Parent
local SettingsFrame = GUI:WaitForChild("Settings")
local Buttons = SettingsFrame.List
Buttons.Shadows.BTN.MouseButton1Click:Connect(function()
if game.Lighting.GlobalShadows == true then
game.Lighting.GlobalShadows = false
Buttons.Shadows.BTN.Text = "OFF"
Buttons.Shadows.BTN.BackgroundColor3 = OffColor
elseif game.Lighting.GlobalShadows == false then
game.Lighting.GlobalShadows = true
Buttons.Shadows.BTN.Text = "ON"
Buttons.Shadows.BTN.BackgroundColor3 = OnColor
end
end)
local lighting = game:GetService("Lighting")
local SettingsFrame = GUI:WaitForChild("Settings")
local shadowsOff = false
local function changeShadows()
if not shadowsOff then
shadowsOff = true
lighting.GlobalShadows = false
Buttons.Shadows.BTN.Text = "OFF"
Buttons.Shadows.BTN.BackgroundColor3 = OffColor
else
shadowsOff = false
lighting.GlobalShadows = true
Buttons.Shadows.BTN.Text = "ON"
Buttons.Shadows.BTN.BackgroundColor3 = OnColor
end
end
Buttons.Shadows.BTN.Activated:Connect(changeShadows)