Advertisement
bobopopcornboy

TANK

Sep 10th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.04 KB | None | 0 0
  1. wait(1)
  2. owner = game.Players.bobopopcornboy
  3.  
  4. Folder = Instance.new('Model')
  5. Folder.Parent = workspace
  6. Folder.Name = "Tank"
  7. pos = Vector3.new(0,0.5,0)
  8. ro = Vector3.new(0,180,0)
  9. Wheel = Instance.new('Part')
  10. Wheel.Parent = Folder
  11. Wheel.Size = Vector3.new(22.9874324798584,4.138504981994629,12.38792896270752)
  12. Wheel.Position = Vector3.new(pos.X + 16.371414184570312,pos.Y + 1.8168296813964844,pos.Z + -0.48949432373046875)
  13. Wheel.Rotation = Vector3.new(ro.X + -180,ro.Y + 0,ro.Z + -180)
  14. Base = Instance.new('Part')
  15. Base.Parent = Folder
  16. Base.Size = Vector3.new(24.348304748535156,5.756950378417969,12.505230903625488)
  17. Base.Position = Vector3.new(pos.X + 16.490482330322266,pos.Y + 3.610198974609375,pos.Z + -0.5)
  18. Base.Rotation = Vector3.new(ro.X + -180,ro.Y + 0,ro.Z + -180)
  19. Head = Instance.new('Part')
  20. Head.Parent = Folder
  21. Head.Size = Vector3.new(11.290436744689941,4.064630508422852,8.793956756591797)
  22. Head.Position = Vector3.new(pos.X + 17.950275421142578,pos.Y + 8.282885551452637,pos.Z + -0.2089996337890625)
  23. Head.Rotation = Vector3.new(ro.X + -180,ro.Y + 0,ro.Z + -180)
  24. Gun = Instance.new('Part')
  25. Gun.Parent = Folder
  26. Gun.Size = Vector3.new(10.676332473754883,1.6956206560134888,2.9556143283843994)
  27. Gun.Position = Vector3.new(pos.X + 7.673534393310547,pos.Y + 7.329769134521484,pos.Z + -0.38297271728515625)
  28. Gun.Rotation = Vector3.new(ro.X + -180,ro.Y + 0,ro.Z + -180)
  29. Tread = Instance.new('Part')
  30. Tread.Parent = Folder
  31. Tread.Size = Vector3.new(23.28107261657715,4.452668190002441,12.106224060058594)
  32. Tread.Position = Vector3.new(pos.X + 16.355464935302734,pos.Y + 1.7263336181640625,pos.Z + -0.48949432373046875)
  33. Tread.Rotation = Vector3.new(ro.X + -180,ro.Y + 0,ro.Z + -180)
  34. Seat = Instance.new('VehicleSeat')
  35. Seat.Parent = Folder
  36. Seat.Size = Vector3.new(3,1,3)
  37. Seat.Position = Vector3.new(pos.X + 19.09549331665039,pos.Y + 9.815200805664062,pos.Z + -0.31202125549316406)
  38. Seat.Rotation = Vector3.new(ro.X + 0,ro.Y + -90,ro.Z + 0)
  39. Seat.Transparency = 1
  40. --Mesh
  41. Mesh = Instance.new("SpecialMesh")
  42. Mesh.Parent = Gun
  43. Mesh.MeshId = "rbxassetid://1379683528"
  44. Mesh.TextureId = "rbxassetid://1379698208"
  45. Mesh.Scale = Vector3.new(2.22, 2.22, 2.22) --done
  46. Mesh = Instance.new("SpecialMesh")
  47. Mesh.Parent = Head
  48. Mesh.MeshId = "rbxassetid://1379682889"
  49. Mesh.TextureId = "rbxassetid://1379698208"
  50. Mesh.Scale = Vector3.new(2.22, 2.22, 2.22) --done
  51. Mesh = Instance.new("SpecialMesh")
  52. Mesh.Parent = Base
  53. Mesh.MeshId = "rbxassetid://1379684325"
  54. Mesh.TextureId = "rbxassetid://1379698208"
  55. Mesh.Scale = Vector3.new(2.22, 2.22, 2.22) --done
  56. Mesh = Instance.new("SpecialMesh")
  57. Mesh.Parent = Tread
  58. Mesh.MeshId = "rbxassetid://1379685716"
  59. Mesh.TextureId = "rbxassetid://1379699159"
  60. Mesh.Scale = Vector3.new(2.22, 2.22, 2.22) --done
  61. Mesh = Instance.new("SpecialMesh")
  62. Mesh.Parent = Wheel
  63. Mesh.MeshId = "rbxassetid://1379684915"
  64. Mesh.TextureId = "rbxassetid://1379698208"
  65. Mesh.Scale = Vector3.new(2.23, 2.23, 2.23) --done
  66. --Welds
  67. --[[Not Use
  68. co = Instance.new("WeldConstraint")
  69. co.Parent = Folder
  70. co.Part0 = Base
  71. co.Part1 = Head
  72. co = Instance.new("WeldConstraint")
  73. co.Parent = Folder
  74. co.Part0 = Head
  75. co.Part1 = Gun
  76. ]]--
  77. co = Instance.new("WeldConstraint")
  78. co.Parent = Folder
  79. co.Part0 = Wheel
  80. co.Part1 = Tread
  81. co = Instance.new("WeldConstraint")
  82. co.Parent = Folder
  83. co.Part0 = Base
  84. co.Part1 = Wheel
  85. co = Instance.new("WeldConstraint")
  86. co.Parent = Folder
  87. co.Part0 = Head
  88. co.Part1 = Seat
  89. --pivots
  90. At1 = Instance.new("Attachment")
  91. At1.Parent = Base
  92. At1.Orientation = Vector3.new(0, 0, 90)
  93. At1.Position = Vector3.new(1.213, 2.832, 0.1)
  94. At2 = Instance.new("Attachment")
  95. At2.Parent = Head
  96. At2.Orientation = Vector3.new(-180, -180, -90)
  97. At2.Position = Vector3.new(1, -2.032, 0)
  98. HBRotation = Instance.new("HingeConstraint")
  99. HBRotation.Attachment0 = At1
  100. HBRotation.Attachment1 = At2
  101. HBRotation.Parent = Folder
  102. HBRotation.ActuatorType = Enum.ActuatorType.Servo
  103. HBRotation.ServoMaxTorque = math.huge
  104. HBRotation.AngularResponsiveness = math.huge
  105. HBRotation.AngularSpeed = math.huge
  106. At3 = Instance.new("Attachment")
  107. At3.Parent = Gun
  108. At3.Orientation = Vector3.new(-90, -90, 0)
  109. At3.Position = Vector3.new(5.277, -0.079, 0.174)
  110. At4 = Instance.new("Attachment")
  111. At4.Parent = Head
  112. At4.Orientation = Vector3.new(-90, -90, 0)
  113. At4.Position = Vector3.new(-5, -1.032, 0)
  114. HGRotation = Instance.new("HingeConstraint")
  115. HGRotation.Attachment0 = At3
  116. HGRotation.Attachment1 = At4
  117. HGRotation.Parent = Folder
  118. HGRotation.ActuatorType = Enum.ActuatorType.Servo
  119. HGRotation.ServoMaxTorque = math.huge
  120. HGRotation.AngularResponsiveness = math.huge
  121. HGRotation.AngularSpeed = math.huge
  122. event = Instance.new("RemoteEvent")
  123. event.Parent = Folder
  124. event.Name = "event"
  125. TLP = Instance.new('Part')
  126. TLP.Parent = Folder
  127. TLP.Size = Vector3.new(23.5,1,2.5)
  128. TLP.Position = Vector3.new(pos.X + 16.566329956054688,pos.Y + 3.4886741638183594,pos.Z + 4.502614974975586)
  129. TLP.Rotation = Vector3.new(ro.X + 0,ro.Y + 0,ro.Z + 0)  
  130. TRP = Instance.new('Part')
  131. TRP.Parent = Folder
  132. TRP.Size = Vector3.new(23.5,1,2.5)
  133. TRP.Position = Vector3.new(pos.X + 16.566329956054688,pos.Y + 3.4886741638183594,pos.Z + -5.497385025024414)
  134. TRP.Rotation = Vector3.new(ro.X + 0,ro.Y + 0,ro.Z + 0)
  135. TRP.Transparency = 1
  136. TLP.Transparency = 1
  137.  
  138.  
  139. TR = Instance.new('BodyThrust',TRP)
  140. TL = Instance.new('BodyThrust',TLP)
  141.  
  142. co = Instance.new("WeldConstraint")
  143. co.Parent = Folder
  144. co.Part0 = Wheel
  145. co.Part1 = TRP
  146. co = Instance.new("WeldConstraint")
  147. co.Parent = Folder
  148. co.Part0 = Wheel
  149. co.Part1 = TLP
  150.  
  151.  
  152. lscript = owner.PlayerGui.tankLocal
  153.  
  154. local mass = 0
  155.  
  156. for i, v in pairs(Folder:GetChildren()) do
  157.     if v:IsA("BasePart") then
  158.         mass = mass + (v:GetMass() * 196.2)
  159.     end
  160. end
  161.  
  162. Seat.Changed:Connect(function(prop)
  163.     if prop == "Occupant" then
  164.         if Seat.Occupant then
  165.             local lc = lscript:Clone()
  166.             lc.Parent = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent).PlayerGui
  167.             lc.Name = "CLONE"
  168.         else
  169.            
  170.         end
  171.     end
  172. end)
  173. event.OnServerEvent:Connect(function(plyr,target,hit)
  174.     if target.Parent:FindFirstChild("Humanoid") then
  175.         target.Parent.Humanoid.Health = 0
  176.     end
  177.    
  178.     local x1 = At1.WorldPosition.X
  179.     local y1 = At1.WorldPosition.Z
  180.     local x2 = hit.X
  181.     local y2 = hit.Z
  182.     local dx = x1 - x2
  183.     local dy = y1 - y2
  184.     local angle = math.atan2(dy,dx)
  185.     angle = math.deg(-angle)
  186.     HBRotation.TargetAngle = angle - Base.Rotation.Y
  187.     --explosion
  188.     local tnt = Instance.new("Explosion")
  189.     tnt.Parent = workspace
  190.     tnt.BlastRadius = 100
  191.     tnt.Position = hit.Position
  192.     tnt.BlastPressure = 2000
  193.     tnt.DestroyJointRadiusPercent = 0
  194.     tnt.ExplosionType = Enum.ExplosionType.Craters
  195. end)
  196.  
  197. while wait() do
  198.     local dir = Seat.Steer
  199.     local fo = Seat.Throttle
  200.     local f = mass/2
  201.     if dir == 0 then
  202.         TR.Force =Vector3.new(fo*f,0,0)
  203.         TL.Force = Vector3.new(fo*f,0,0)
  204.         if fo == 0 then
  205.             TR.Force = Vector3.new(0,0,0)
  206.             TL.Force = Vector3.new(0,0,0)
  207.             TRP.Velocity = Vector3.new()
  208.             TLP.Velocity = Vector3.new()
  209.         end
  210.     else
  211.         if dir == -1 then
  212.             TR.Force = Vector3.new(f,0,0)
  213.             TL.Force = Vector3.new(-f,0,0)
  214.         else
  215.             TR.Force = Vector3.new(-f,0,0)
  216.             TL.Force = Vector3.new(f,0,0)
  217.         end
  218.     end
  219. end
  220.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement