Advertisement
Anukun_Lucifer

LOCK Script

Apr 25th, 2023
2,321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | Gaming | 0 0
  1. function onTouched(hit)
  2.     if hit.Parent:findFirstChild("Humanoid") ~= nil then
  3.         if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
  4.             if hit.Parent:findFirstChild(script.Parent.Parent.Key.Value) ~= nil then
  5.                 if script.Parent.Parent.KeyRemove.Value == true then
  6.                     hit.Parent:findFirstChild(script.Parent.Parent.Key.Value):remove()
  7.                 end
  8.                 local door = script.Parent
  9.                 local opensound = script.Parent.Parent.door_open
  10.                 local closesound = script.Parent.Parent["Door Close"]
  11.                 door.CFrame = door.CFrame* CFrame.Angles(0, math.rad(90), 0)
  12.                 door.CFrame  = door.CFrame + Vector3.new(3, 0, 3.4)
  13.                 door.CanTouch = false
  14.                 opensound:Play()
  15.                 wait(3)
  16.                 door.CFrame = door.CFrame* CFrame.Angles(0, math.rad(-90), 0)
  17.                 door.CFrame  = door.CFrame + Vector3.new(-3, 0, -3.4)
  18.                 closesound:Play()
  19.                 door.CanTouch = true
  20.                 wait(2)
  21.             end
  22.         end
  23.     end
  24. end
  25. script.Parent.Touched:connect(onTouched)
Tags: Roblox lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement