Advertisement
mattofm

Blocks autotrap all players

Dec 24th, 2020
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. --BLOCKS auto trap all by Terry Davis on v3rmillion.net
  2. -- please like the thread if you found it useful
  3. -- https://v3rmillion.net/showthread.php?tid=1084626
  4.  
  5. lp = game.Players.LocalPlayer
  6. char = lp.Character
  7. boxSize = 6
  8.  
  9. --I RECOMMEND MAKING THE BLOCKS TRANSPARENT SO YOU CAN SEE OUTSIDE OF THE boxes
  10. --MAKING THEM FULLY TRANSPARENT WILL ANNOY PEOPLE MORE
  11. --CHANGE TRANSPARENCY IN THE NORMAL INGAME GUI or in the script below
  12.  
  13. --gets your ingame block settings
  14. color,b,transparency,reflectance = game.ReplicatedStorage.GetBlockData:InvokeServer()
  15.  
  16. function placeBlock(x,y,z)
  17. char.Place.Build:FireServer(
  18. Vector3.new(x, y, z), --position as specified by parameters x,y,z
  19. color,
  20. true, -- not sure what this does
  21. b or "SmoothPlastic", --material
  22. transparency, --overide transparency here (0 is opaque, 1 is transparent)
  23. reflectance
  24. )
  25. end
  26.  
  27.  
  28. function equip()
  29. --equips tool - tool has to be equipped to place blocks
  30. if lp.Backpack:FindFirstChild("Place") then
  31. char.Humanoid:EquipTool(lp.Backpack:FindFirstChild("Place"))
  32. end
  33. end
  34.  
  35.  
  36. function makeBox(player,size)
  37. size = size/2
  38. char.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame
  39. pos = player.Character.HumanoidRootPart.Position
  40. equip() -- equips Place tool
  41. wait(0.1)
  42. --Make floor
  43. for i2 = -size,size do
  44. for i = -size,size do
  45. placeBlock(pos.X+3*i,pos.Y-size*1.5-3,pos.Z+3*i2)
  46. end
  47. end
  48. --Make walls
  49. for i2 = 0,size do
  50. for i = -size,size do
  51. placeBlock(pos.X+3*i,pos.Y-size*1.5+i2*3,pos.Z+size*3)
  52. placeBlock(pos.X+3*i,pos.Y-size*1.5+i2*3,pos.Z-size*3)
  53. placeBlock(pos.X-size*3,pos.Y-size*1.5+i2*3,pos.Z+3*i)
  54. placeBlock(pos.X+size*3,pos.Y-size*1.5+i2*3,pos.Z+3*i)
  55. end
  56. end
  57. --Make roof
  58. for i2 = -size,size do
  59. for i = -size,size do
  60. placeBlock(pos.X+3*i,pos.Y+size*1.5+3,pos.Z+3*i2)
  61. end
  62. end
  63. end
  64.  
  65. --function for boxing new players
  66. function onJoin(player)
  67. player:WaitForChild("HumanoidRootPart")
  68. makeBox(game.Players:FindFirstChild(player.Name),boxSize)
  69. end
  70.  
  71. -- hooks Autobox function to box new players
  72. game.Players.PlayerAdded:Connect(function(player)
  73. player.CharacterAdded:Connect(onJoin)
  74. end)
  75.  
  76. for i,v in pairs(game.Workspace.Spawns:GetChildren()) do
  77. --boxes spawns
  78. char.HumanoidRootPart.CFrame = v.CFrame
  79. wait(0.1)
  80. makeBox(lp,15)
  81. wait(1.5)
  82. end
  83.  
  84. for i,v in pairs(game.Workspace.Spawns:GetChildren()) do
  85. --boxes spawns above so that people don't respawn above and escape
  86. char.HumanoidRootPart.CFrame = v.CFrame+Vector3.new(0,35,0)
  87. wait(0.1)
  88. makeBox(lp,15)
  89. wait(1.5)
  90. end
  91.  
  92.  
  93. -- boxes all players currently in game
  94. for i,v in pairs(game.Players:GetChildren()) do
  95. if v.Name ~= lp.Name then -- checks if selected player is you / localplayer
  96. makeBox(v,boxSize)
  97. -- autoboxes player when they respawn
  98. if v ~= nil then v.CharacterAdded:Connect(onJoin) end
  99. wait(1)
  100. end
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement