Alex325

Hamster Ball

Sep 26th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. scale = 10
  2.  
  3. function weld(tab)
  4. local last = nil
  5. for i,v in pairs(tab) do
  6. if v:IsA("BasePart") then
  7. if last then
  8. local w = Instance.new("Weld",last)
  9. w.Part0 = w.Parent
  10. w.Part1 = v
  11. local pos = last.CFrame:toObjectSpace(v.CFrame)
  12. w.C0 = pos
  13. end
  14. last = v
  15. end
  16. end
  17. end
  18.  
  19. function makeball(pos)
  20. local model = Instance.new("Model",workspace)
  21. local rand = BrickColor.Random()
  22. for i=0,340,20 do
  23. wait()
  24. for z=-90,70,20 do
  25. local p = Instance.new("Part",model)
  26. p.formFactor = "Custom"
  27. p.BrickColor = rand
  28. p.Transparency = 0.5
  29. p.Size = Vector3.new(scale/5.5,scale/5.5,scale/140)
  30. p.Anchored = true
  31. p.TopSurface = 0
  32. p.BottomSurface = 0
  33. p.CFrame = CFrame.new(pos) * CFrame.Angles(math.rad(z),math.rad(i),0) * CFrame.new(0,0,-scale/2)
  34. p:breakJoints()
  35. end
  36. end
  37. weld(model:children())
  38. for i,v in pairs(model:children()) do v.Anchored = false end
  39. model:MakeJoints()
  40. end
  41.  
  42.  
  43. makeball(game.Players.LocalPlayer.Character.Torso.Position+Vector3.new(0,scale/2-2.5,0))
Add Comment
Please, Sign In to add comment