Why does the closet stop working when I activate this ProximityPrompt

Why every time i activate this ProximityPrompt the ProximityPrompt no longer works?

ClosetActivates

Activate Script:

local ProximitPrompt = script.Parent

ProximitPrompt.Triggered:Connect(function(player)
	if script.Hiding.Value == false then
		script.Hiding.Value = true
		script.Parent.Enabled = false
	player.Character.HumanoidRootPart.Position = script.Parent.Parent.Parent.Position.Position
			player.Character.Humanoid.WalkSpeed = 0
	end
end)

ActivateExit script:

local ProxPrompt = script.Parent
local hiding = script.Parent.Parent.Parent.Activate.ProximityPrompt.Script.Hiding
ProxPrompt.Triggered:Connect(function(player)
	if hiding.Value == true then
		hiding.Value = false
	script.Parent.Parent.Parent.Activate.ProximityPrompt.Enabled = true
	player.Character.HumanoidRootPart.Position = script.Parent.Parent.Parent.PositionExit.Position
		player.Character.Humanoid.WalkSpeed = 16
	end
end)

Please tell me if somthings wrong that i put in both of the scripts.

Probably because it’s never reenabeld

Do you ever set this Boolean’s value to True again
image

yes, I do set it to true in another script

No, You are just disabling the ProximityPrompt, not the script, should still work

It wont teleport the player to the closet after i activate the exit ProximityPrompt

local ProxPrompt = script.Parent
local hiding = script.Parent.Parent.Parent.Activate.ProximityPrompt.Script.Hiding
ProxPrompt.Triggered:Connect(function(player)
	if hiding.Value == true then
		hiding.Value = false
	script.Parent.Parent.Parent.Activate.ProximityPrompt.Enabled = true
	player.Character.HumanoidRootPart.Position = script.Parent.Parent.Parent.PositionExit.Position
		player.Character.Humanoid.WalkSpeed = 16
	end
end)

You are not checking if Hiding is equal to false

if hiding.Value == false then
		hiding.Value = true
	-- Rest of you code here
elseif hiding.Value == true then
hiding.Value = false

script.Parent.Parent.Parent.Activate.ProximityPrompt.Enabled = true
	player.Character.HumanoidRootPart.Position = script.Parent.Parent.Parent.PositionExit.Position
		player.Character.Humanoid.WalkSpeed = 16
 
	end

There is 2 scripts. one that disables hiding, and one that enables hiding. I forgot to double cheak the image and theres a boolValue under the script. Sorry I forgot to say it and I realized.

Screenshot 2022-11-11 210027