Script won't enable/disable Screen UI

Hello, I was trying to create a settings feature for my game to help reduce lag, and I tried making one of them disable a screen shader image, but it won’t do anything. I am unsure of what to do because I absolutely suck at scripting, so I came here for help. The script is a localscript in StarterGui

local Bool = script.Parent:FindFirstChildWhichIsA("BoolValue")
checked = false
db = false

script.Parent.MouseButton1Click:Connect(function()
	if not db then
		db = true
		if not checked then
			script.Parent.Image = "rbxassetid://6693687289"
			checked = true
			Bool.Value = true
			game.StarterGui.ScreenOverlay.Enabled = false
		else
			script.Parent.Image = "rbxassetid://6693686795"
			checked = false
			Bool.Value = false
			game.StarterGui.ScreenOverlay.Enabled = true
		end
		db = false
	end	
end)
local Bool = script.Parent:FindFirstChildWhichIsA("BoolValue")
checked = false
db = false
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if not db then
		db = true
		if not checked then
			script.Parent.Image = "rbxassetid://6693687289"
			checked = true
			Bool.Value = true
			player.PlayerGui.ScreenOverlay.Enabled = false
		else
			script.Parent.Image = "rbxassetid://6693686795"
			checked = false
			Bool.Value = false
			player.PlayerGui.ScreenOverlay.Enabled = true
		end
		db = false
	end	
end)
1 Like