Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a Click to Open door?

Asked by 6 years ago

I have gotten the LocalPlayer's mouse in a local script so now what?

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Insert a ClickDetector inside the part

function onClicked()
wait(0.1)
script.Parent.Transparency = 1
script.Parent.CanCollide = true
wait(2)--amount of time before door is closed
script.Parent.Transparency = 0
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Ad

Answer this question