door = script.Parent;
locked = true
function setform(v)
locked = v
if v then
door.Transparency = 0
door.Reflectance = 0.4
door.CanCollide = true
else
door.Transparency = 0.7
door.Reflectance = 0
door.CanCollide = false
end
end
function click()
if locked then
setform(false)
wait(5)
setform(true)
end
end
door.ClickDetector.MouseClick:connect(click)
✓ ANSWER ACCEPTED
How would I make it so only a specific person can open this door?
1 answer
✓ Accepted answer
Actually, with the unused Click parameter returned though the ClickDetector's MouseClick Signal, we can apply it in your "Click()" function.
That parameter actually give the PlayerObject of who Clicked, so we can get their Name, preferably UserId for versatility, to debounce the function from running if they don't match
local UserId = {
-- Players' UserIds that can open the Door (In a table so you can compare multiple.
};
function Click(Player)
if (Player.UserId ~= UserIds[Player.UserId] then return end
-- Everything else
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I don't understand where exactly I put that script above.
local function pls XD