daily pastebin goal
39%
SHARE
TWEET

PrivateArea

a guest Jun 20th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. wait(0.05)
  2. script.Parent = nil
  3. local Owner = game.Players.LocalPlayer
  4. local AllowedPlayers= {'iMannyz'}
  5. table.insert(AllowedPlayers,Owner.Name)
  6. local Parts = {}
  7. local Active = false
  8. local Rot = 0
  9. local RotSpeed = 5
  10. local Radius = 0
  11. local PartSize = Vector3.new(4,5,.1)
  12.  
  13. function Split(inputstr,sep)
  14.     local t,i = {},1
  15.     for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  16.         t[i] = str
  17.         i = i + 1
  18.     end
  19.     return t
  20. end
  21. function Createparts(radius)
  22.     local Number = math.ceil(radius/1.5)
  23.     Radius = radius
  24.     for i = 1,Number do
  25.         local p = Instance.new("Part",workspace.Terrain)
  26.         p.Name = "PrivateArea"
  27.         p.Size = PartSize
  28.         p.Material = "Neon"
  29.         p.Locked = true
  30.         p.BrickColor = BrickColor.new('Persimmon')
  31.         p.Anchored = true
  32.         p.Transparency = 0
  33.         p.CanCollide = false
  34.         p.CFrame = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").CFrame
  35. --      local pe = script.Particle:Clone()
  36. --      pe.Parent = p
  37.         table.insert(Parts,p)
  38.     end
  39.     Active = true
  40. end
  41.  
  42. workspace.Terrain.ChildRemoved:connect(function(v)
  43.     if Active then
  44.         for x,y in pairs(Parts) do
  45.             if v == y then
  46.                 table.remove(Parts,x)
  47.                 local p = Instance.new("Part",workspace.Terrain)
  48.                 p.Name = "PrivateArea"
  49.                 p.Size = PartSize
  50.                 p.Material = "Neon"
  51.                 p.Locked = true
  52.                 p.BrickColor = BrickColor.new('Persimmon')
  53.                 p.Anchored = true
  54.                 p.Transparency = 1
  55.                 p.CanCollide = false
  56.                 p.CFrame = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").CFrame
  57.                 --local pe = script.Particle:Clone()
  58.                 --pe.Parent = p
  59.                 table.insert(Parts,p)
  60.             end
  61.         end
  62.     end
  63. end)
  64.  
  65. Owner.Chatted:connect(function(msg)
  66.     local Args = Split(msg,' ')
  67.     if Args[1] == "private" and tonumber(Args[2]) ~= nil then
  68.         if Active then
  69.             Active = false
  70.             repeat
  71.             for i,v in pairs(Parts) do
  72.                 table.remove(Parts,i)
  73.                 v:Destroy()
  74.             end
  75.             until #Parts == 0
  76.         end
  77.         Createparts(tonumber(Args[2]))
  78.     elseif Args[1] == "rs" and tonumber(Args[2]) ~= nil then
  79.         RotSpeed = tonumber(Args[2])
  80.     elseif Args[1] == "public" then
  81.         Active = false
  82.         repeat
  83.         for i,v in pairs(Parts) do
  84.             table.remove(Parts,i)
  85.             v:Destroy()
  86.         end
  87.         until #Parts == 0
  88.     elseif Args[1] == "add" then
  89.         for i,v in pairs(game.Players:GetPlayers()) do
  90.             if string.find(v.Name,Args[2]) then
  91.                 table.insert(AllowedPlayers,v.Name)
  92.             end
  93.         end
  94.     elseif Args[1] == "remove" then
  95.         for i,v in pairs(game.Players:GetPlayers()) do
  96.             if string.find(v.Name,Args[2])then
  97.                 for x,y in pairs(AllowedPlayers) do
  98.                     if y == v.name and y ~= "iMannyz" then
  99.                         table.remove(AllowedPlayers,x)
  100.                     end
  101.                 end
  102.             end
  103.         end
  104.     end
  105. end)
  106.  
  107. game:GetService'RunService'.RenderStepped:connect(function()
  108.     Rot = Rot>=360 and 0 or Rot + RotSpeed
  109.     local Ow = game.Players.LocalPlayer
  110.     local Selectedpart = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
  111.     local Dist = (#Parts*1.5)
  112.     for i,part in pairs(Parts) do
  113.         part.CFrame = part.CFrame:lerp(CFrame.new(Selectedpart.Position.X, Selectedpart.Position.Y, Selectedpart.Position.Z) * CFrame.Angles(0, math.rad(i*(360/#Parts)+Rot), 0) * CFrame.new(0,1,Dist), .15)
  114.     end
  115.     if Active then
  116.         for i,v in pairs(game.Players:GetPlayers()) do
  117.             local check = false
  118.             for x,y in pairs(AllowedPlayers) do
  119.                 if y == v.Name then
  120.                     check = true
  121.                 end
  122.             end
  123.             if check == false then
  124.                 local PlrDist = (Ow.Character.HumanoidRootPart.Position - v.Character.HumanoidRootPart.Position).magnitude
  125.                 if  PlrDist <= Radius then
  126.                     if v.Character:FindFirstChild("HumanoidRootPart") then
  127.                         v.Character.HumanoidRootPart.CFrame = v.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,(Radius+5 - PlrDist))
  128.                     end
  129.                 end
  130.             end
  131.         end
  132.     end
  133. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top