Fire code when local changes

Local Script

if back == true then
	print("event fired")
	GUI.Back.Visible = true
	GUI.BackButton.Visible = true
end

Back is a local inside of the rest of the script. It ends up changing in the rest of the script; say if you want me to send the rest of the local script or not. How and help need understand.

You could make this a BoolValue in your GUI/Script and just use Changed.

1 Like

Do I have to do a BoolValue or can I just do a local?

As far as I know there is no non-hacky way to tell when a variable changes. You could even just do this:

local backBool = Instance.new("BoolValue", script.Parent)
local back = backBool.Value
2 Likes