DarkScriptZEditors

Private baseplate

Jan 8th, 2019
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. lp = owner
  2. moving = false
  3. char = lp.Character
  4. head = char.Head
  5. torso = nil
  6. whitelisted = {}
  7. if char:FindFirstChild("Torso") then
  8. torso = char:FindFirstChild("Torso")
  9. elseif char:FindFirstChild("UpperTorso") then
  10. torso = char:FindFirstChild("UpperTorso")
  11. elseif char:FindFirstChild("Torso") ~= true and char:FindFirstChild("UpperTorso") ~= true then
  12. error("Torso not found, required")
  13. end
  14. base = Instance.new("Part",char)
  15. base.Anchored = true
  16. base.Size = Vector3.new(100,1,100)
  17. base.BrickColor = head.BrickColor
  18. base.CFrame = CFrame.new(math.random(-1000,1000),1000,math.random(-1000,1000))
  19. torso.CFrame = base.CFrame + Vector3.new(0,10,0)
  20. lp.Chatted:connect(function(msg)
  21. if string.sub(msg,1,string.len("b/allow/")) == "b/allow/" then
  22. victimname = string.sub(msg,string.len("b/allow/")+1,string.len(msg))
  23. table.insert(whitelisted,1,victimname)
  24. end
  25. if string.sub(msg,1,string.len("b/disallow/")) == "b/disallow/" then
  26. victimname = string.sub(msg,string.len("b/disallow/")+1,string.len(msg))
  27. for d=1, #whitelisted do
  28. if whitelisted[d].Name == victimname then
  29. table.remove(whitelisted,d)
  30. end
  31. end
  32. end
  33. if msg == "b/tp" then
  34. torso = nil
  35. char = lp.Character
  36. if char:FindFirstChild("Torso") then
  37. torso = char:FindFirstChild("Torso")
  38. elseif char:FindFirstChild("UpperTorso") then
  39. torso = char:FindFirstChild("UpperTorso")
  40. elseif char:FindFirstChild("Torso") ~= true and char:FindFirstChild("UpperTorso") ~= true then
  41. error("Torso not found, required")
  42. end
  43. torso.CFrame = base.CFrame + Vector3.new(0,10,0)
  44. end
  45. if msg == "b/move" then
  46. moving = true
  47. end
  48. if msg == "b/nomove" then
  49. moving = false
  50. end
  51. end)
  52. allowed = nil
  53. warn([[
  54. Chat commands:
  55. b/allow/[FULL player name] - whitelists a player so they can enter your base
  56. b/disallow/[FULL player name] - removes a whitelisted player so they can no longer enter your base
  57. b/tp - teleports you back to your base
  58. b/move - starts moving base
  59. b/nomove - stops moving base
  60. ]])
  61. while true do
  62. wait(0.01)
  63. if moving == true then
  64. base.CFrame = torso.CFrame - Vector3.new(0,1.8,0)
  65. end
  66. gc = game:GetService("Players"):GetPlayers()
  67. for g=1, #gc do
  68. if gc[g] ~= lp then
  69. if gc[g].Character ~= nil then
  70. if gc[g].Character:FindFirstChild("Head") then
  71. if (gc[g].Character:FindFirstChild("Head").Position - base.Position).magnitude < 150 then
  72. allowed = false
  73. for h=1, #whitelisted do
  74. if whitelisted[h] == gc[g].Name then
  75. allowed = true
  76. end
  77. end
  78. if allowed == false then
  79. if gc[g].Character ~= nil then
  80. gc[g].Character:ClearAllChildren()
  81. end
  82. end
  83. end
  84. end
  85. end
  86. end
  87. end
  88. end
Add Comment
Please, Sign In to add comment