Script not checking when GUI is visable

Hello. This is a weird one. I am currently trying to fix a script I wrote, and I have very little idea of why it is not working.

I have a local script that makes a check mark visible, pretty simple. Here is that script:

local Check1 = script.Parent.Parent.Setting1Check
local Button1 = script.Parent

Button1.MouseButton1Click:Connect(function()
	Check1.Visible = not Check1.Visible
end)

Here is the 2nd local script. This checks if the check mark is visible:

if script.Parent.Visible == false then
	print("It is not visible")
else
	print("it is visible")
end

I think the problem is that it changes the visible property locally, but I am not sure. It prints “it is visible” but when I click the button and the check mark goes visible, it doesn’t print like its supposed to do. I do not know the fix for this. Sadly I am on a crappy keyboard right now so I do not have much motivation to figure it out. Anyone got an idea of what is happening?

is the 2nd script a server script? if so, yea

It is a local script.

What is that supposed to mean? I’m sorry for not understanding

Can I see your explorer…? There should be no reason why this is not working…

There is no problems in the pathing.

Something I forgot to mention: It prints “it is visible” but when I click the button and the check mark goes visible, it doesn’t print like its supposed to do

1 Like

Probably because it only prints once since i dont see any loops or :GetPropertyChangedSignal, or changed… i think your problem is the script is running once, and doesnt run again.

1 Like

Will this code work?

script.Parent:GetPropertyChangedSignal("Visible"):Connect(function()
	if script.Parent.Visible == false then
		print("It is not visible")
	else
		print("it is visible")
	end
end)
1 Like

woah, I tried using GetPropertyChangedSignal(). It did not work so I deleted in because why have the script be more advanced then it needs to be. I guess I messed it up, because this works amazing. Thank you!

1 Like

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