Hello,
So basically I’m currently working on a little puzzle in which a picklock is required to open a door. The way it works is that you touch the door’s hitbox part with the tool in your hand in which afterwards enables the script for the door that lets you open and close it. The problem I’m currently facing is that for some reason the tool isn’t detecting the part? Here’s the setup + 2 simple scripts:
Setup image #1:

Setup image #2:

Inside the “MetalDoorScript” script (Enables the disabled “DoorScript” script which makes the door functionable after touching “LockpickingHitbox” part with the tool in your hand):
local LockpickingHitbox = script.Parent
local LockpickProp = game.Workspace.Givers.lockpick
local LockpickingSound = LockpickingHitbox.LockpickingSound
local Proximity = LockpickingHitbox.Parent.DoorFrame.ProximityPrompt
local DoorScript = LockpickingHitbox.Parent.DoorScript
function ontouch(hit)
local lockpickkey = hit:findFirstChild("lockpickkey")
if lockpickkey then hit.Parent:Destroy()
LockpickProp:Destroy()
LockpickingSound:Play()
script.Disabled = true
LockpickingSound.Ended:Wait()
script.Disabled = false
DoorScript.Enabled = true
Proximity.Enabled = true
LockpickingHitbox:Destroy()
end
end
script.Parent.Touched:Connect(ontouch)
The code inside “DoorScript” (Makes the door be able to open/close using a ProximityPrompt):
local frame = script.Parent:WaitForChild("DoorFrame")
local openSound = frame:WaitForChild("DoorOpen")
local creakSound = frame:WaitForChild("DoorCreak")
local closedSound = frame:WaitForChild("DoorClosed")
local proximityprompt = frame:WaitForChild("ProximityPrompt")
local model = script.Parent
local frameClose = model:WaitForChild("DoorFrameClose")
local frameOpen = model:WaitForChild("DoorFrameOpen")
local tweenService = game:GetService("TweenService")
proximityprompt.Triggered:Connect(function()
if proximityprompt.ActionText == "Close" then
proximityprompt.ActionText = "Open"
creakSound:Play()
frame.CanCollide = true
tweenService:Create(frame,TweenInfo.new(1.845),{CFrame = frameClose.CFrame}):Play()
wait(1.74349)
closedSound:Play()
else
proximityprompt.ActionText = "Close"
openSound:Play()
frame.CanCollide = false
tweenService:Create(frame,TweenInfo.new(1.845),{CFrame = frameOpen.CFrame}):Play()
end
end)
Am I overlooking something? The weirdest part is that there’s no errors in the output and I’ve also made sure that the hitbox part has CanTouch enabled but it still seems to not detect the part. This OnTouch script has worked with some other similar puzzles with no problem, not sure what’s going on this time.
Image of the famous part:
It’s an invisible MeshPart the same size as the door and in the same position as it. I’d appreciate any of your help on this issue as this is frustrating now! Hope my explanation made sense.
