InTesting

Pokeball thing

Aug 18th, 2019
773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.52 KB | None | 0 0
  1. print'https://pastebin.com/gHS0fTnj'
  2. -- if you're gonna use my content dont remove this line ^
  3. print'press E: (on character) Capture'
  4. print'E: (Anywhere with player in hand): Release'
  5.  
  6. local function Boot_Leg_Poke_Ball(player)
  7.     script.Parent = player:FindFirstChildWhichIsA'PlayerGui'
  8.     local tw,players = game:GetService("TweenService"),game:GetService("Players")
  9.     local pchar = player.Character
  10.     local function Get_Components_Of_Mouse(player)
  11.            
  12.         local pchar = player.Character
  13.        
  14.         if pchar then
  15.             local Remote = pchar:FindFirstChild('∞RE_Mouse')
  16.             if not Remote then
  17.                 Remote = Instance.new("RemoteEvent",pchar)
  18.                 Remote.Name = 'RE_Mouse'
  19.             end
  20.            
  21.            
  22.            
  23.             Remote.Parent = NLS(
  24.                 [[
  25. local lp = game:GetService'Players'.LocalPlayer
  26. local mouse = lp:GetMouse()
  27. local runs = game:GetService'RunService'
  28.  
  29. wait(1)
  30.  
  31. local re = script:WaitForChild('RE_Mouse')
  32. if re then
  33.     mouse.KeyDown:Connect(function(k)
  34.         re:FireServer('KeyDown',k,mouse.Hit,mouse.Target)
  35.     end)
  36.    
  37.     re.OnClientEvent:Connect(function(arg1,arg2)
  38.         if arg1=='ChangeMouseIcon'then
  39.             mouse.Icon = arg2
  40.         end
  41.     end)
  42. else
  43.     print('Fat try again.')
  44. end
  45.                     ]]
  46.                     ,pchar)
  47.                 return Remote
  48.             else
  49.                 error('Best to actually put your character in the game.')
  50.             end
  51.         end
  52.     local RE = Get_Components_Of_Mouse(player)
  53.    
  54.     local tool,handle,capture,head,l_arm =
  55.         Instance.new("Tool"),Instance.new("Part"),false,pchar:WaitForChild'Head',
  56.         pchar:WaitForChild'Left Arm'
  57.     handle.BrickColor = BrickColor.new("Really red")
  58.     handle.Name = 'Handle'
  59.     handle.Shape = 'Ball'
  60.     handle.Size = Vector3.new(1,1,1)
  61.     handle.Material = 'Neon'
  62.     handle.Parent = pchar
  63.     handle.CFrame = l_arm.CFrame*CFrame.new(0,-1,0)
  64.     handle.CanCollide = false
  65.     handle.Massless = true
  66.     local s = Instance.new("Sound",handle)
  67.     s.Volume = 4
  68.     s.SoundId = 'rbxassetid://1467076382'
  69.     s.Looped = true
  70.     s:Play()
  71.     local w,captured = Instance.new("WeldConstraint",pchar)
  72.     w.Part0 = l_arm
  73.     w.Part1 = handle
  74.    
  75.     local function Make_PB(End_CFrame)
  76.         local p = Instance.new("Part")
  77.         p.Size = Vector3.new(1,1,1)
  78.         p.BrickColor = BrickColor.new("Really red")
  79.         p.Shape = 'Ball'
  80.         p.Material = 'Neon'
  81.         p.Position = l_arm.Position
  82.         p.Parent = pchar
  83.         p.CFrame = l_arm.CFrame*CFrame.new(0,-1,0)
  84.         p.CanCollide = true
  85.         p.Massless = true
  86.         p.Anchored = true
  87.        
  88.         local ti = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,
  89.             0,false,0)
  90.         local prop = {Position = l_arm.Position}
  91.         local prop2 = {Position = End_CFrame.Position + Vector3.new(0,5,0)}
  92.         return p,prop,prop2,ti
  93.     end
  94.     local function Make_Msg(Text)
  95.         local BG =  head:FindFirstChildWhichIsA'BillBoardGui'or Instance.new("BillboardGui",head)
  96.         BG.ExtentsOffsetWorldSpace = Vector3.new(0,5,0)
  97.         BG.Size = UDim2.new(5,0,2,0)
  98.         BG.Enabled = true
  99.        
  100.         local TL = BG:FindFirstChildWhichIsA'TextLabel'or Instance.new("TextBox",BG)
  101.         TL.BackgroundTransparency = 1
  102.         TL.TextScaled = true
  103.         TL.Size = UDim2.new(1,0,1,0)
  104.         TL.Font = 'Code'
  105.         TL.TextColor3 = Color3.new(255,255,255)
  106.         TL.TextStrokeColor3 = Color3.new(0,0,0)
  107.         TL.TextStrokeTransparency = 0
  108.         TL.Text = ''
  109.  
  110.         spawn(function()
  111.             for i=1,Text:len()do
  112.                 TL.Text = Text:sub(1,i)
  113.                 wait()
  114.             end
  115.             wait(.1)
  116.             BG.Enabled = false
  117.         end)
  118.         return BG
  119.     end
  120.     local function Get_Player_From_Character_Descendant(ob)
  121.         if ob then
  122.             local full_1 = ob:GetFullName()
  123.             local sep1 = string.find(full_1:lower(),'%.')
  124.             if sep1 then
  125.                 local sep2 = string.find(full_1:lower(),'%.',sep1 + 1)
  126.                 if sep2 then
  127.                     local char_name = full_1:sub(sep1 + 1,sep2 - 1)
  128.                     if char_name then
  129.                         local player = game:service'Players':FindFirstChild(char_name)
  130.                         if player then
  131.                             return player
  132.                         end
  133.                     end
  134.                 end
  135.             end
  136.         end
  137.     end
  138.     local function Weldc(a,b)
  139.         local w = a:FindFirstChildWhichIsA'WeldConstraint'or Instance.new('WeldConstraint',a)
  140.         w.Part0 = a w.Part1 = b
  141.     end
  142.  
  143.     if RE then
  144.         RE.OnServerEvent:Connect(function(pl,...)
  145.             local para = {...}
  146.             if pl==player then
  147.                 if para[1]=='KeyDown'then
  148.                     if para[2]=='e'then
  149.                         local pl = Get_Player_From_Character_Descendant(para[4])
  150.                         if not capture and pl and not captured and para[3]then
  151.                             capture = true
  152.                             local p_c = pl.Character
  153.                             local head = p_c:FindFirstChild'Head'
  154.                             local hrp = p_c:FindFirstChild'HumanoidRootPart'
  155.                             local p,en,st,inf = Make_PB(l_arm.CFrame)
  156.                            
  157.                             handle.Transparency = 1
  158.                             head.Anchored = true
  159.                            
  160.                             tw:Create(p,inf,{CFrame = para[3]}):Play()
  161.                             wait(1)p.Anchored = false
  162.                            
  163.                             wait(.5)
  164.                             for _,v in pairs(p_c:GetDescendants())do
  165.                                 if v:IsA'BasePart'then
  166.                                     v.Massless = true
  167.                                     v.Transparency = 1
  168.                                     if v.Name=='Torso'then
  169.                                         p.CFrame = v.CFrame
  170.                                         Weldc(p,v)
  171.                                     end
  172.                                 elseif v:IsA'Humanoid'then
  173.                                     v.PlatformStand = true
  174.                                 elseif v:IsA'Motor6D'then
  175.                                     if v.Name~='Neck'and v.Name~='Root'and v.Name~='Waist'
  176.                                         and v.Name~='RootJoint'then
  177.                                         v:Destroy()
  178.                                     end
  179.                                 elseif v:IsA'Decal'then
  180.                                     v:Destroy()
  181.                                 else
  182.                                     pcall(function()
  183.                                         v:Destroy()
  184.                                     end)
  185.                                 end
  186.                             end
  187.                             head.Anchored = false
  188.                             captured = pl.Name
  189.                             Make_Msg'Gotcha!'
  190.                             head.CFrame = p.CFrame
  191.                             Weldc(p,head)
  192.                             wait(.5)p.Anchored = true
  193.                             wait(.5)
  194.                             tw:Create(p,inf,{Position = l_arm.Position}):Play()
  195.                             wait(1)
  196.                             hrp.CFrame = handle.CFrame
  197.                             Weldc(handle,hrp)
  198.                             p:Destroy()
  199.                             handle.Transparency = 0
  200.                             capture = false
  201.                         elseif not capture and para[3]and captured~=nil then
  202.                             capture = true
  203.                             local p,en,st,inf = Make_PB(para[3])
  204.                             local tar = game:service'Players':FindFirstChild(captured)
  205.                            
  206.                             if tar then
  207.                                 handle.Transparency = 1
  208.                                
  209.                                 for _,v in pairs(p:GetChildren())do
  210.                                     if v:IsA'WeldConstraint'then v:Destroy()end
  211.                                 end
  212.  
  213.                                 tw:Create(p,inf,{CFrame = para[3]}):Play()
  214.                                 wait(1)
  215.                                 Make_Msg(tar.Name.. ', I choose you!')
  216.                                 captured = nil
  217.                                 tar:LoadCharacter()
  218.                                 local tchar = tar.Character
  219.                                 local tors = tchar:FindFirstChild'Torso'
  220.                                 local hrp = tchar:FindFirstChild'HumanoidRootPart'
  221.                                 hrp.CFrame = p.CFrame
  222.                                 for _,v in pairs(p:GetChildren())do
  223.                                     if v:IsA'WeldConstraint'then v:Destroy()end
  224.                                 end
  225.                                 for _,v in pairs(tchar:GetDescendants())do
  226.                                     if v:IsA'BasePart'and v.Name~='HumanoidRootPart'then
  227.                                         v.Transparency = 0
  228.                                         v.Massless = false
  229.                                     elseif v:IsA'Humanoid'then
  230.                                         v.PlatformStand = false
  231.                                     end
  232.                                 end
  233.                                 wait()
  234.                                 p.CanCollide = false
  235.                                 p.Anchored = false
  236.                                 handle.Transparency = 0
  237.                             else
  238.                                 captured = nil
  239.                             end
  240.                             capture = false
  241.                         end
  242.                     end
  243.                 end
  244.             end
  245.         end)
  246.     end
  247.     workspace.ChildAdded:Connect(function(ch)
  248.         if ch.Name==captured and not capture then
  249.             wait()
  250.             for _,v in pairs(ch:GetDescendants())do
  251.                 if v:IsA'BasePart'then
  252.                     v.Massless = true
  253.                     v.Transparency = 1
  254.                     if v.Name=='Torso'then
  255.                         v.CFrame = handle.CFrame
  256.                         Weldc(handle,v)
  257.                     end
  258.                 elseif v:IsA'Humanoid'then
  259.                     v.PlatformStand = true
  260.                 elseif v:IsA'Motor6D'then
  261.                     if v.Name~='Neck'and v.Name~='Root'and v.Name~='Waist'
  262.                         and v.Name~='RootJoint'then
  263.                         v:Destroy()
  264.                     end
  265.                 elseif v:IsA'Decal'then
  266.                     v:Destroy()
  267.                 else
  268.                     v:Destroy()
  269.                 end
  270.             end
  271.         end
  272.     end)
  273. end
  274. wait(1)
  275. Boot_Leg_Poke_Ball(owner) --// InTesting on Pastebin.
Add Comment
Please, Sign In to add comment