I am working on a Proximity Door that’s locked. When you touch a key and equip it. It allows you to unlock the door. If you unequip the key it returns back to “Locked mode”. But, I keep bumping into this error.
If you know anything, please mention it below. Thank you for reading!
local tool = script.Parent
local sound = script.Sound
local Proxy1 = game.Workspace.ProximityDoor.DoorFrame.UnlockPrompt
local Proxy2 = game.Workspace.ProximityDoor.DoorFrame.Locked
tool.Equipped:Connect(function(equipped)
Proxy1.Enabled = true
Proxy2.Enabled = false
sound:Play()
end)
tool.Unequipped:Connect(function(unequipped)
Proxy1.Enabled = false
Proxy2.Enabled = true
end)
It has to do with the Proxy2, I am supposing that this variable is boolean, due to your error message.
I suppose you have the wrong path towards the object, maybe instead of “Locked” your 2nd Proximity Prompt is called LockedPrompt, else another object or property could be called “Locked”.
Actually it isn’t nil because Locked is a property of a basepart to prevent you from clicking on it in the workspace. Having children of objects be the same name as a property can cause scripts to index the property instead of the child object. This is why it retrieved a boolean instead of a child object. And the error says this: Attempt to index boolean with Enabled.