TheUnknownDiscord

building

Nov 1st, 2021 (edited)
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- tool useless too lazy to remove
  2. local debris = game:GetService("Debris")
  3. Tool = Instance.new("Tool")
  4. Part1 = Instance.new("Part")
  5. Part1.Name = "Handle"
  6. Part1.Parent = Tool
  7. Tool.Parent = owner.Character
  8. Tool.Name = "builder"
  9. local built = {} -- storing built parts
  10.  
  11. buildremote = Instance.new("RemoteEvent",owner.Character)
  12. buildremote.Name = "The"
  13. buildremote.OnServerEvent:Connect(function(plr,action,pos)
  14. if action == "Build" then -- placing part
  15. Brick = Instance.new("Part", workspace)
  16. Brick.Size = Vector3.new(2.5,2.5,2.5)
  17. Brick.Position = pos
  18. Brick.Anchored = true
  19. Brick.Material = Enum.Material.SmoothPlastic
  20. decal = Instance.new("Texture", Brick)
  21. decal.StudsPerTileU = 1.25
  22. decal.StudsPerTileV = 1.25
  23. decal.Texture = "http://www.roblox.com/asset/?id=8346980490"
  24. decal.Face = Enum.NormalId.Front
  25. local clone = decal:Clone()
  26. clone.Parent = Brick
  27. clone.Face = Enum.NormalId.Back
  28. local clone = decal:Clone()
  29. clone.Parent = Brick
  30. clone.Face = Enum.NormalId.Top
  31. local clone = decal:Clone()
  32. clone.Parent = Brick
  33. clone.Face = Enum.NormalId.Bottom
  34. local clone = decal:Clone()
  35. clone.Parent = Brick
  36. clone.Face = Enum.NormalId.Left
  37. local clone = decal:Clone()
  38. clone.Parent = Brick
  39. clone.Face = Enum.NormalId.Right
  40. Brick.Color = Color3.fromRGB(30, 30, 30)
  41. table.insert(built,Brick) -- storing to delete them later if want
  42. elseif action == "Destroy" then -- breaking part
  43. if table.find(built,pos) then -- checking if part to break is a part you built
  44. oldcf = pos.CFrame
  45. oldpartcolor = pos.Color
  46. pos:Destroy()
  47. local mined = Instance.new("Sound", owner.Character.Head)
  48. mined.SoundId = "rbxassetid://6496157434"
  49. mined.Volume = 1
  50. mined:Play()
  51. debris:AddItem(mined,1)
  52. for i = 1, 5 do
  53. -- debris stuff
  54. local partdebris = Instance.new("Part",script)
  55. partdebris.Shape = Enum.PartType.Ball
  56. partdebris.Size = Vector3.new(0.25,0.25,0.25)
  57. partdebris.Color = oldpartcolor
  58. local Mesh = Instance.new("SpecialMesh")
  59. Mesh.Parent = partdebris
  60. Mesh.MeshType = "Brick"
  61. Mesh.Scale = Vector3.new(1, 1, 1)
  62. partdebris.CanTouch = false
  63. partdebris.Material = Enum.Material.SmoothPlastic
  64. partdebris.CFrame = oldcf * CFrame.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
  65. partdebris:ApplyImpulse(CFrame.new(oldcf.Position,partdebris.Position).lookVector * 0.0625)
  66. debris:AddItem(partdebris,6)
  67. end
  68. end
  69. end
  70. end)
  71. NLS([[
  72. local Tool = owner.Character:WaitForChild("builder")
  73. local buildremote = owner.Character:WaitForChild("The")
  74. local mouse = owner:GetMouse()
  75. local off = false
  76. local equipped = false
  77. local posx
  78. local posy
  79. local posz
  80. Brick2 = Instance.new("Part", owner.Character) -- cursor hover
  81. Brick2.Size = Vector3.new(2.5,2.5,2.5)
  82. Brick2.Anchored = true
  83. Brick2.Material = Enum.Material.SmoothPlastic
  84. Brick2.Transparency = 0.65
  85. Brick2.CanCollide = false
  86. oldcolor = Brick2.Color
  87. local gridsize = 2.5
  88.  
  89.  
  90. building = true
  91. game:GetService("RunService").RenderStepped:Connect(function() -- constant mouse update
  92. if building then
  93. posx = math.floor(mouse.Hit.X/gridsize + 0.5) * gridsize
  94. posy = math.floor(mouse.Hit.Y/gridsize + 0.5) * gridsize
  95. posz = math.floor(mouse.Hit.Z/gridsize + 0.5) * gridsize
  96. local pos2 = Vector3.new(posx,posy,posz)
  97. Brick2.Position = pos2
  98. elseif not building then
  99. Brick2.Position = mouse.Target.Position
  100. end
  101. end)
  102. mouse.Button1Down:Connect(function()
  103. if building then
  104. local pos = Vector3.new(posx,posy,posz)
  105. buildremote:FireServer("Build", pos)
  106. elseif not building then
  107. buildremote:FireServer("Destroy", mouse.Target)
  108. end
  109. end)
  110. count = 0
  111. function buildswitch(key) -- switching from destroy to build or build to destroy
  112. key = key:lower()
  113. if key == "q" then
  114. count = count + 1
  115. if count == 1 then
  116. building = false
  117. Brick2.Color = Color3.fromRGB(184, 65, 65)
  118. Brick2.Size = Vector3.new(2.6,2.6,2.6)
  119. elseif count == 2 then
  120. building = true
  121. Brick2.Color = oldcolor
  122. Brick2.Size = Vector3.new(2.5,2.5,2.5)
  123. task.wait()
  124. count = 0
  125. end
  126. end
  127. end
  128. mouse.KeyDown:Connect(buildswitch)
  129. ]], owner.Character)
  130. print([["Q is to change between
  131. building or destroying"]])
  132. print("Click to make or break a part")
  133. warn("DIAMONDS AAAAAAAAAAAA")
  134. warn("Made by Haker Man / Lucas_YT111")
RAW Paste Data