Advertisement
HowToRoblox

KeyDetector

Apr 17th, 2020
1,755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. local door = script.Parent
  2.  
  3.  
  4. door.Touched:Connect(function(touch)   
  5.    
  6.        
  7.     local char = touch.Parent
  8.    
  9.     local plr = game.Players:GetPlayerFromCharacter(char)
  10.    
  11.    
  12.     if not plr then return end
  13.    
  14.    
  15.     if char:FindFirstChild("Key") then
  16.        
  17.        
  18.         door.Transparency = 1
  19.         door.CanCollide = false
  20.        
  21.         wait(5)
  22.        
  23.         door.Transparency = 0
  24.         door.CanCollide = true
  25.        
  26.     end
  27.    
  28. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement