Help with script not working!

  1. What do you want to achieve? Saturation levels change on each press of the button

  2. What is the issue? The saturation levels won’t change even tho the text changing works

  3. What solutions have you tried so far? “using db == true/false” for the “else if” instead of “Saturation = number

WHAT THE BUTTON LOOKS LIKE

Screenshot 2024-04-21 171327

local lighting = game:GetService("Lighting")
local ColorCorrection = lighting.CC
local Saturation = ColorCorrection.Saturation
local Button = script.Parent
local text = Button.Text
local db = 1

Button.MouseButton1Click:Connect(function()
	if db == 1 then--High
		db = 0
		Saturation = 0.35
		text.Text = "Saturation High"
	else if Saturation == 0.35 then --Extreme
		Saturation = 0.42
		text.Text = "Saturation Extreme"
		else if Saturation == 0.42 then -- Ultra
			Saturation = 0.5
			text.Text = "Saturation Ultra"
			else if Saturation == 0.5 then -- Insane
		Saturation = 0.6
		text.Text = "Saturation Insane"
				else if Saturation == 0.6 then -- None
						Saturation = 0
						text.Text = "Saturation None"
					else if Saturation == 0 then -- Low
							Saturation = 0.1
							text.Text = "Saturation Low"
						else if Saturation == 0.1 then -- Medium
								Saturation = 0.2
								db = 1
								text.Text = "Saturation Medium"
								end
						end
						end
		end
	end
		end
	end
end)
1 Like

common mistake people make is that you redefine variables instead of changing the value itself.

example:

local val = workspace.number.value
val = 1
--sets the variable "val" to 1, not "number"

local val = workspace.number
val.value = 1
--sets the actualt value of the "number" in workspace.

hope this helps!

2 Likes

Thank you so much, I never considered attempting this

1 Like

I done it, worked at first then after re-playing it broke
very strange
(edit)
nvm it was a case of another script attempting to do the same thing which ended up breaking the code

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.