Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Door that needs a key to open
- local part = script.Parent
- local wall = game.Workspace.Wall
- local canOpen = true
- local function lift(otherPart)
- local partParent = otherPart.Parent
- local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
- if humanoid and canOpen then
- local player = game.Workspace:FindFirstChild(partParent.Name)
- if player then
- if player:FindFirstChild('Key') then
- canOpen = false
- wall.Transparency = 1
- wall.CanCollide = false
- local key = player:FindFirstChild('Key')
- key.Parent = game.Workspace
- key.Handle.Position = Vector3.new(math.random(x1,x2),5,math.random(z1,z2))
- wait(2)
- wall.Transparency = 0
- wall.CanCollide = true
- canOpen = true
- end
- end
- end
- end
- part.Touched:Connect(lift)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement