Advertisement
RiasGremory0100

Untitled

Jul 10th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. local Ball = script.Parent;
  2. local Tool = Ball.Parent;
  3. local Capture = Tool.Capture
  4. local Player = Tool.Player
  5. local Players = Tool.Players
  6. local Gui = Tool.Gui
  7. local cpt = Tool.Cpt:Clone()
  8. local rls = Tool.Rls:Clone()
  9.  
  10. function Cam(Player, Subject)
  11. local new_script = script.Camera:clone()
  12. new_script.Disabled = false
  13. new_script.Sub.Value = Subject
  14. new_script = new_script:clone()
  15. new_script.Parent = Player
  16. wait(0.04)
  17. end
  18.  
  19. function removeGui(gui)
  20. for i = 0.2, 1, .1 do
  21. gui.BackgroundTransparency = i
  22. wait(0.075)
  23. end
  24. gui.Parent:remove()
  25. end
  26.  
  27. function onTouch(hit)
  28. connection:disconnect()
  29. if Capture.Value == true then --when released
  30. Ball.Anchored = true
  31. local c = Instance.new("Smoke")
  32. c.Parent = Ball
  33. c.RiseVelocity = 4
  34. rls.Parent = Ball
  35. wait(2)
  36. if Players.Value and Gui.Value then
  37. removeGui(Gui.Value.TextLabel)
  38. Cam(Players.Value.Backpack, Player.Value.Humanoid)
  39. end
  40. --wait(.04)
  41. Player.Value.Parent = Workspace
  42. Player.Value:makeJoints()
  43. if Player.Value:IsA("Model") then
  44. Player.Value:MoveTo(Ball.Position)
  45. elseif Player.Value:IsA("BasePart") then
  46. Player.Value.CFrame = Ball.CFrame + Vector3.new(0, 5, 0)
  47. else
  48. Player.Value.Parent = Workspace
  49. print("Cannot move type "..Player.Value.className)
  50. end
  51. Ball.Release.Volume = 1
  52. Ball.Release:Play()
  53. --wait(0.3)
  54. --c:remove()
  55. Capture.Value = false
  56. Player.Value = nil
  57. Tool.Name = "Pokeball"
  58. Ball:remove()
  59. else
  60. local humanoid = hit.Parent:findFirstChild("Humanoid")
  61. if humanoid and humanoid.Parent ~= Tool.Parent then --when caught
  62. local spark = Instance.new("Sparkles")
  63. Ball.Anchored = true
  64. cpt.Parent = Ball
  65. spark.Parent = Ball
  66. spark.Color = Color3.new(1, 0, 0)
  67. Capture.Value = true
  68. Player.Value = humanoid.Parent
  69. Ball.CaptureSound.Volume = 1
  70. Ball.CaptureSound:Play()
  71. Tool.Name = Player.Value.Name
  72. Players.Value = game.Players:GetPlayerFromCharacter(humanoid.Parent)
  73. if Players.Value then
  74. Gui.Value = Tool.CaptureGui:clone()
  75. Gui.Value.Parent = Players.Value.PlayerGui
  76. Cam(Players.Value.Backpack, Tool.Handle)
  77. end
  78. --wait(.04)
  79. humanoid.Parent.Parent = game.Lighting
  80. wait(2)
  81. Ball:remove()
  82. else
  83. wait(2)
  84. Ball:remove()
  85. end
  86. end
  87. end
  88.  
  89. connection = Ball.Touched:connect(onTouch)
  90.  
  91. local debounce = false
  92.  
  93. function getPlayer(humanoid)
  94. local players = game.Players:children()
  95. for i = 1, #players do
  96. if players[i].Character.Humanoid == humanoid then return players[i] end
  97. end
  98. return nil
  99. end
  100.  
  101. function onTouch(part)
  102.  
  103. local human = part.Parent:findFirstChild("Humanoid")
  104. if (human ~= nil) and debounce == false then
  105.  
  106. debounce = true
  107.  
  108. local player = getPlayer(human)
  109.  
  110. if (player == nil) then return end
  111.  
  112. script.Parent:clone().Parent = player.Backpack
  113.  
  114. wait(2)
  115. debounce = false
  116. end
  117. end
  118.  
  119.  
  120. script.Parent.Parent.Touched:connect(onTouch)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement