Advertisement
CrazIIZen

Lock

May 6th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. repeat wait() until script:findFirstChild("crash")
  2.  
  3. backup = script.crash:clone()
  4.  
  5. admins = {"CrazIIZen","popcape1","admin 2","etc."}
  6.  
  7. locked = false
  8.  
  9. ps = game:GetService("Players")
  10.  
  11. keylock = "/lock"
  12. keyunlock = "/unlock"
  13.  
  14. h = Instance.new("Hint")
  15. h.Text = "[Server Locked] ID:0978009 :To Open /unlock Wait for the trainers instructions. "
  16.  
  17. function isadmin(namestring)
  18. for i = 1,#admins do
  19. if namestring == admins[i] then
  20. return true
  21. end
  22. end
  23. return false
  24. end
  25.  
  26. ps.PlayerAdded:connect(function(p)
  27. if isadmin(p.Name) == true then
  28. repeat wait() until p.PlayerGui
  29. local m = Instance.new("Message",p.PlayerGui)
  30. m.Text = "Say '"..keylock.."' to lock the server and '"..keyunlock.."' to unlock it."
  31. game:GetService("Debris"):AddItem(m,5)
  32. p.Chatted:connect(function(msg)
  33. if msg == keylock and locked == false then
  34. locked = true
  35. h.Parent = Workspace
  36. end
  37. if msg == keyunlock and locked == true then
  38. locked = false
  39. h.Parent = nil
  40. end
  41. end)
  42. end
  43. if locked == true and isadmin(p.Name) == false then
  44. repeat wait() until p.PlayerGui
  45. local c = backup:clone()
  46. c.Parent = p.PlayerGui
  47. end
  48. end)
  49.  
  50. print("server lock loaded")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement