I want to make where a player steps on a part and the "door" opens so they can go through it but closes after 5 seconds. The "Door" has no script, its just a part I named for this script fyi. Here's what I got so far:
local function onTouched(otherPart)
local character = otherPart.Parent
if character then
local player = game.Players:GetPlayerFromCharacter(character)
if player then
game.Workspace.Part.Door.CanCollide = false
game.Workspace.Part.Door.Transparency = 1
wait(5)
game.Workspace.Part.Door.CanCollide = true
game.Workspace.Part.Door.Transparency = 0
return onTouched
end
end
end
script.Parent.Touched:Connect(onTouched)

1 comment
:O Thanks! I almost going to 200 points :D