MoxieOnTop

soccer ball script

Dec 15th, 2022 (edited)
1,465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. --[[
  2.  
  3. subscribe to plaxif for more showcases
  4. credits to MyWorld#4430 for scripting this
  5.  
  6. recommended hats:
  7. roblox.com/catalog/62234425
  8. roblox.com/catalog/63690008
  9. roblox.com/catalog/62724852
  10. roblox.com/catalog/451220849
  11. roblox.com/catalog/48474294
  12. roblox.com/catalog/48474313
  13.  
  14. note: works with any 6 hats
  15.  
  16. ]]
  17.  
  18. local netboost = Vector3.new(0, 45, 0)
  19.  
  20. local ws = game:GetService("Workspace")
  21. local rs = game:GetService("RunService")
  22. local lp = game:GetService("Players").LocalPlayer
  23.  
  24. local function align(Part0, Part1)
  25. Part0.CustomPhysicalProperties = PhysicalProperties.new(0.0001, 0.0001, 0.0001, 0.0001, 0.0001)
  26.  
  27. local att1 = Instance.new("Attachment")
  28. att1.Orientation = Vector3.new(0, 0, 0)
  29. att1.Position = Vector3.new(0, 0, 0)
  30. att1.Archivable = true
  31. local att0 = att1:Clone()
  32.  
  33. local ap = Instance.new("AlignPosition", att0)
  34. ap.ApplyAtCenterOfMass = false
  35. ap.MaxForce = math.huge
  36. ap.MaxVelocity = math.huge
  37. ap.ReactionForceEnabled = false
  38. ap.Responsiveness = 200
  39. ap.RigidityEnabled = false
  40.  
  41. local ao = Instance.new("AlignOrientation", att0)
  42. ao.MaxAngularVelocity = math.huge
  43. ao.MaxTorque = math.huge
  44. ao.PrimaryAxisOnly = false
  45. ao.ReactionTorqueEnabled = false
  46. ao.Responsiveness = 200
  47. ao.RigidityEnabled = false
  48.  
  49. ap.Attachment1 = att1
  50. ap.Attachment0 = att0
  51. ao.Attachment1 = att1
  52. ao.Attachment0 = att0
  53.  
  54. att1.Parent = Part1
  55. att0.Parent = Part0
  56.  
  57.  
  58. if netboost then
  59. spawn(function()
  60. while rs.Heartbeat:Wait() and Part0 and Part0.Parent do
  61. Part0.Velocity = netboost
  62. end
  63. end)
  64. spawn(function()
  65. while rs.Stepped:Wait() and Part0 and Part0.Parent and Part1 and Part1.Parent do
  66. Part0.Velocity = Part1.Velocity
  67. end
  68. end)
  69. end
  70. end
  71. local c = lp.Character
  72. local function gp(parent, name, className)
  73. local ret = nil
  74. if parent then
  75. for i, v in pairs(parent:GetChildren()) do
  76. if (v.Name == name) and v:IsA(className) then
  77. ret = v
  78. end
  79. end
  80. end
  81. return ret
  82. end
  83. local startpart = gp(c, "Torso", "BasePart") or gp(c, "HumanoidRootPart", "BasePart") or gp(c, "Head", "BasePart")
  84. if not startpart then
  85. print("part not found")
  86. return
  87. end
  88. local size = Vector3.new(1, 1, 2)
  89. local orient = {
  90. Vector3.new(45 ,-45, 0),
  91. Vector3.new(45, -135, 0),
  92. Vector3.new(0, 90, 0),
  93. Vector3.new(45, 45, 0),
  94. Vector3.new(45, 135, 0),
  95. Vector3.new(0, 0, 0)
  96. }
  97. local hats = {}
  98. for i, v in pairs(c:GetChildren()) do
  99. if v:IsA("Accessory") then
  100. table.insert(hats, v)
  101. end
  102. end
  103. local allhandles = {}
  104. for i, v in pairs(hats) do
  105. local handle = gp(v, "Handle", "BasePart")
  106. if handle then
  107. table.insert(allhandles, handle)
  108. end
  109. end
  110. local handles = {}
  111. for i, v in pairs(allhandles) do
  112. if v.Size == size then
  113. table.insert(handles, v)
  114. end
  115. end
  116. if #handles < #orient then
  117. for i, v in pairs(allhandles) do
  118. if not table.find(handles, v) then
  119. table.insert(handles, v)
  120. end
  121. if #handles == #orient then
  122. break
  123. end
  124. end
  125. end
  126. if #handles < #orient then
  127. print("not enough hats")
  128. return
  129. end
  130. local ball = Instance.new("Part", ws)
  131. ball.Anchored = true
  132. ball.CanCollide = false
  133. ball.CanTouch = false
  134. ball.Transparency = 1
  135. ball.Shape = "Ball"
  136. ball.Size = Vector3.new(2.3, 2.3, 2.3)
  137. ball.Position = startpart.Position
  138. for i, v in pairs(orient) do
  139. local handle = handles[i]
  140. handle:ClearAllChildren()
  141. local part = Instance.new("Part", ball)
  142. part.Massless = true
  143. part.Transparency = 1
  144. part.Anchored = true
  145. part.CanCollide = false
  146. part.Position = ball.Position
  147. part.Orientation = v
  148. local weld = Instance.new("WeldConstraint", part)
  149. weld.Part0 = ball
  150. weld.Part1 = part
  151. weld.Enabled = true
  152. handle.Parent = part
  153. align(handle, part)
  154. part.Anchored = false
  155. handle.Changed:Connect(function(prop)
  156. if (prop == "Parent") and part and part.Parent then
  157. part:Destroy()
  158. end
  159. end)
  160. end
  161. ball.CanCollide = true
  162. ball.Anchored = false
  163. c.Changed:Connect(function(prop)
  164. if (prop == "Parent") and ball and ball.Parent then
  165. ball:Destroy()
  166. end
  167. end)
Advertisement
Add Comment
Please, Sign In to add comment