Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Admin Door Script loaded") ---(You can still use this for doors too lol)
- -- *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*
- --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)
- permission = {"Yamanohera15523","A friend","Another friend", "Another Friend", "Another Friend", "And so on" }
- function checkOkToLetIn(name)
- for i = 1,#permission do
- -- Example, builderman's name is all lower case, so if you put Builderman or bUILDERMAN it doesn't work for him
- -- "So like Shindiggy but not shindiggy or sHINDIGGY or SHINDIGGY and so on"
- if (string.upper(name) == string.upper(permission[i])) then return true end
- end
- return false
- end
- local Door = script.Parent
- function onTouched(hit)
- print("Door Hit")
- local human = hit.Parent:findFirstChild("Humanoid")
- if (human ~= nil ) then
- print("Human touched door")
- if (checkOkToLetIn(human.Parent.Name)) then
- print("Human passed test")
- Door.Transparency = 0.5
- Door.CanCollide = false
- 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)
- Door.CanCollide = true
- Door.Transparency = 0
- 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
- end
- end
- end ---Remember when you always script there has to be an end!
- script.Parent.Touched:connect(onTouched)
- ---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