Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onTouched(hit)
- if hit.Parent:findFirstChild("Humanoid") ~= nil then
- if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
- if hit.Parent:findFirstChild(script.Parent.Parent.Key.Value) ~= nil then
- if script.Parent.Parent.KeyRemove.Value == true then
- hit.Parent:findFirstChild(script.Parent.Parent.Key.Value):remove()
- end
- local door = script.Parent
- local opensound = script.Parent.Parent.door_open
- local closesound = script.Parent.Parent["Door Close"]
- door.CFrame = door.CFrame* CFrame.Angles(0, math.rad(90), 0)
- door.CFrame = door.CFrame + Vector3.new(3, 0, 3.4)
- door.CanTouch = false
- opensound:Play()
- wait(3)
- door.CFrame = door.CFrame* CFrame.Angles(0, math.rad(-90), 0)
- door.CFrame = door.CFrame + Vector3.new(-3, 0, -3.4)
- closesound:Play()
- door.CanTouch = true
- wait(2)
- end
- end
- end
- end
- script.Parent.Touched:connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement