Bool value is false but script doesnt see this

I’m trying to make a frame appear when as a helping gui when a player presses a clickdetector without a key. My issue is the fact that everything works only I dont want the frame to show when the player has the key, so I made a bool value that changes when a players has the key. Only it doesnt work anymore the bool is set to false and I dont have any errors.

wait(0.05)

local Button = game.Workspace:WaitForChild("PrisonDoor"):WaitForChild("KeyHole")
local Click = Button.Detector.ClickDetector
local Gui = script.Parent.Gradient

Click.MouseClick:Connect(function(player)
	if Button.Value == false then
		Gui.Visible = true
	else 
		return
	end
end)


Is your BoolValue named KeyHole? Judging from the name of the instance KeyHole, it makes me assume that it is a BasePart rather than a BoolValue.

alr im feeling so dumb right now your totally right I forgat to add an another .Value behind that line tysm

1 Like

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