Hello all, I have created a LocalScript which is supposed to make a gui image visible / invisible according to if a player has a boolean value which is true

This loads the image (SwordC), but, if I make "SwordU" true, then it doesn't make the SwordC image invisible, and I have no idea as to why.

Any and all help is appreciated!!! :)

local plr = game.Players.LocalPlayer

while true do
	wait(1)
	 if plr.Bools.SwordC.Value == true then
		script.Parent.Parent.Parent.Parent.Parent.SwordC.Visible = true
		script.Parent.LocalScript.Disabled = false
	elseif plr.Bools.SwordU.Value == true then
		script.Parent.Parent.Parent.Parent.SwordC.Visible = false	
	end
end

4 comments

0

Set the value to false after making the frame visible?

0

You said the boolean's name was "SwordU", but in the script you're referencing SwordE and SwordR for the if statement?

0

Let me fix that, copied the wrong script, there's multiple jut with simple name changes.

0

Sorry for that, lol.