Advertisement
yamanohera155233

Untitled

Jul 1st, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. print("Admin Door Script loaded") ---(You can still use this for doors too lol)
  2.  
  3. -- *The reason this is for spawns is because if a non-admin breaks in and touches spawn it will kill them and when they respawn it keeps killing them over and over and over so they have to leave*
  4.  
  5. --Put the names of you and whoever else you want to be able to go in your door spawn (you only have to put your name if you dont want anyone else in it)
  6. permission = {"Yamanohera15523","A friend","Another friend", "Another Friend", "Another Friend", "And so on" }
  7.  
  8. function checkOkToLetIn(name)
  9. for i = 1,#permission do
  10. -- Example, builderman's name is all lower case, so if you put Builderman or bUILDERMAN it doesn't work for him
  11. -- "So like Shindiggy but not shindiggy or sHINDIGGY or SHINDIGGY and so on"
  12. if (string.upper(name) == string.upper(permission[i])) then return true end
  13. end
  14. return false
  15. end
  16.  
  17. local Door = script.Parent
  18.  
  19. function onTouched(hit)
  20. print("Door Hit")
  21. local human = hit.Parent:findFirstChild("Humanoid")
  22. if (human ~= nil ) then
  23.  
  24. print("Human touched door")
  25. if (checkOkToLetIn(human.Parent.Name)) then
  26. print("Human passed test")
  27. Door.Transparency = 0.5
  28. Door.CanCollide = false
  29. wait(3) -- This is how long you want it to stay open (I recommend 2-4)Change the number to three or two or put something like 2.5(These are seconds)
  30. Door.CanCollide = true
  31. Door.Transparency = 0
  32. else human.Health= 0 -- If you dont want THE DOOR to kill, ***will NOT work for spawn if it does not kill because ppl can still break in***, delete the line that says else human.Health = 0
  33. end
  34. end
  35. end ---Remember when you always script there has to be an end!
  36.  
  37. script.Parent.Touched:connect(onTouched)
  38.  
  39. ---Note: Cosmicboy37 did not make the original script, I did, cause it was my idea to start with but this is an updated version of it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement