Advertisement
yudhaprawira

eyeball

Jun 29th, 2016
2,489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name = "yudhaprawira"
  2. me = game.Players[yudhaprawira]
  3. char = me.Character
  4. selected = false
  5. hold = false
  6. mode = "blue"
  7.  
  8. happycolors = {"Really blue", "New Yeller", "Lime green", "Really red"}
  9.  
  10. if char:findFirstChild("Ayebull",true) then
  11.     char:findFirstChild("Ayebull",true):remove()
  12. end
  13.  
  14. function prop(part, parent, collide, shape, tran, ref, x, y, z, color, anchor, form)
  15. part.Parent = parent
  16. part.Shape = shape
  17. part.formFactor = form
  18. part.CanCollide = collide
  19. part.Transparency = tran
  20. part.Reflectance = ref
  21. part.Size = Vector3.new(x,y,z)
  22. part.BrickColor = BrickColor.new(color)
  23. part.TopSurface = 0
  24. part.BottomSurface = 0
  25. part.Anchored = anchor
  26. part.Locked = true
  27. part:BreakJoints()
  28. end
  29.  
  30. function weld(w, p, p1, a, b, c, x, y, z)
  31. w.Parent = p
  32. w.Part0 = p
  33. w.Part1 = p1
  34. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  35. end
  36.  
  37. function mesh(mesh, parent, x, y, z, type)
  38. mesh.Parent = parent
  39. mesh.Scale = Vector3.new(x, y, z)
  40. mesh.MeshType = type
  41. end
  42.  
  43. bp = nil
  44. bg = nil
  45. model = nil
  46. ball = nil
  47. ayh = nil
  48. tray = nil
  49. tm = nil
  50.  
  51. function makeball()
  52. local eye = Instance.new("Model")
  53. eye.Name = "Ayebull"
  54. model = eye
  55.  
  56. local main = Instance.new("Part")
  57. prop(main,eye,true,"Ball",0,0,2.6,2.6,2.6,"Institutional white",false,"Custom")
  58. main.CFrame = CFrame.new(char.Head.Position) + Vector3.new(0,4,0)
  59. ball = main
  60.  
  61. local aye = Instance.new("Part")
  62. prop(aye,eye,true,"Ball",0,0,0.7,0.7,0.7,"Really black",false,"Custom")
  63. aye.CFrame = main.CFrame
  64. w1 = Instance.new("Weld")
  65. weld(w1,main,aye,0,0,0,0,0,1.15)
  66. ayh = aye
  67.  
  68. local aye2 = Instance.new("Part")
  69. prop(aye2,eye,true,"Ball",0,0,1.5,1.5,1.5,"Medium blue",false,"Custom")
  70. aye2.CFrame = main.CFrame
  71. w2 = Instance.new("Weld")
  72. weld(w2,main,aye2,0,0,0,0,0,0.6)
  73.  
  74. local bo = Instance.new("BodyPosition",main)
  75. bo.P = 10000
  76. bo.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  77. bo.position = char.Head.Position + Vector3.new(0,5,0)
  78. bp = bo
  79.  
  80. local bl = Instance.new("BodyGyro",main)
  81. bl.P = 100000
  82. bl.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  83. bg = bl
  84.  
  85. local trail = Instance.new("Part")
  86. prop(trail,nil,false,"Block",0,0,0.2,0.2,1,"White",true,"Custom")
  87. tray = trail
  88.  
  89. local tme = Instance.new("SpecialMesh",trail)
  90. mesh(tme,trail,1,1,1,"Brick")
  91. tm = tme
  92.  
  93. coroutine.resume(coroutine.create(function()
  94.     while true do
  95.         wait()
  96.         if char:findFirstChild("Head",true) then
  97.             bp.position = char.Head.Position + Vector3.new(0,5,0)
  98.         end
  99.     end
  100. end))
  101.  
  102. eye.Parent = char
  103. end
  104.  
  105. makeball()
  106.  
  107. if script.Parent.className ~= "HopperBin" then
  108.     local h = Instance.new("HopperBin",me.Backpack)
  109.     h.Name = "Ayebull"
  110.     script.Parent = h
  111. end
  112.  
  113. bin = script.Parent
  114.  
  115. function sel(mouse)
  116.     selected = true
  117.     coroutine.resume(coroutine.create(function()
  118.         while selected do
  119.             wait()
  120.             bg.cframe = CFrame.new(ball.Position, mouse.Hit.p)
  121.         end
  122.     end))
  123.     mouse.Button1Down:connect(function()
  124.         hold = true
  125.         tray.BrickColor = BrickColor.new("Really red")
  126.         tray.Parent = model
  127.         coroutine.resume(coroutine.create(function()
  128.             while hold do
  129.                 wait()
  130.                 local dist = (ayh.Position - mouse.Hit.p).magnitude
  131.                 tm.Scale = Vector3.new(1,1,dist)
  132.                 tray.CFrame = CFrame.new(ayh.Position, mouse.Hit.p) * CFrame.new(0,0,-dist/2)
  133.             end
  134.         end))
  135.         if mode == "color" then
  136.             local col = happycolors[math.random(1,#happycolors)]
  137.             tray.BrickColor = BrickColor.new(col)
  138.             coroutine.resume(coroutine.create(function()
  139.                 while hold do
  140.                     if mouse.Target ~= nil then
  141.                         if mouse.Target.Name ~= "Base" then
  142.                             mouse.Target.BrickColor = tray.BrickColor
  143.                         end
  144.                     end
  145.                     wait()
  146.                 end
  147.             end))
  148.         elseif mode == "remove" then
  149.             tray.BrickColor = BrickColor.new("Bright red")
  150.             if mouse.Target ~= nil then
  151.                 if mouse.Target:GetMass() < 3000 then
  152.                     mouse.Target:remove()
  153.                 end
  154.             end
  155.         end
  156.     end)
  157.     mouse.Button1Up:connect(function()
  158.         hold = false
  159.         tray.Parent = nil
  160.     end)
  161.     mouse.KeyDown:connect(function(key)
  162.         key = key:lower()
  163.         if key == "q" then
  164.             mode = "color"
  165.         elseif key == "f" then
  166.             mode = "remove"
  167.         end
  168.     end)
  169. end
  170.  
  171. function desel()
  172.     selected = false
  173. end
  174.  
  175. bin.Selected:connect(sel)
  176. bin.Deselected:connect(desel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement