I am trying to make a door unlock when a regular part hits it. I tried calling the part, used FindFirstChild, but nothing seems to work, any help?
Are you using a LocalScript or not? Because LocalScripts don’t respond to touching, I don’t think.
I am using a server script, not a localscript
local door = —your door
door.Touched:Connect(function(hit)
if hit.Name == “your part name” then
—unlock the door script here
end
end)
“hit” is the parameter used, it basically is whatever touched it.
Local scripts indeed do respond to touched
events
2 Likes
Could try:
local Door = --Door
local function doorTouched(Hit)
if not Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent.Name == "" then --or Hit.Name == ""...
--Door unlock script here
end
end
doorTouched:Connect(doorTouched)