Awooslayer699

poke ball

May 11th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  4. local RealPlayer = Player
  5. do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  6.  
  7. --[[ Pokeball Script by Dominical ]]--
  8. wait(.3)
  9. balls={}
  10. local player=game.Players.LocalPlayer
  11. local character=player.Character
  12. local tool=Instance.new("Tool",player.Backpack)
  13. tool.Name="Pokeball"
  14. handle = Instance.new("Part",tool)
  15. handle.FormFactor = Enum.FormFactor.Symmetric
  16. handle.Transparency = 1
  17. handle.TopSurface = Enum.SurfaceType.Smooth
  18. handle.Size = Vector3.new(1,1,1)
  19. handle.Name = "Handle"
  20. handle.CFrame = CFrame.new(10.295968055725,0.52928900718689,103.20822143555) * CFrame.Angles(1.5707963705063, 1.5707963705063, 0)
  21. handle.BrickColor = BrickColor.new("White")
  22. handle.Friction = 0.30000001192093
  23. handle.Shape = Enum.PartType.Ball
  24. handle.BottomSurface = Enum.SurfaceType.Smooth
  25. local sound=Instance.new("Sound",handle)
  26. sound.SoundId="http://www.roblox.com/asset?id=131407565"
  27. sound.Volume=1
  28. decal = Instance.new("Decal",handle)
  29. decal.Face = Enum.NormalId.Bottom
  30. decal.Texture = "http://www.roblox.com/asset/?id=25770051"
  31.  
  32. decal = Instance.new("Decal",handle)
  33. decal.Texture = "http://www.roblox.com/asset/?id=25770081"
  34.  
  35. decal = Instance.new("Decal",handle)
  36. decal.Face = Enum.NormalId.Left
  37. decal.Texture = "http://www.roblox.com/asset/?id=25770106"
  38.  
  39. decal = Instance.new("Decal",handle)
  40. decal.Face = Enum.NormalId.Back
  41. decal.Texture = "http://www.roblox.com/asset/?id=25770106"
  42.  
  43. decal = Instance.new("Decal",handle)
  44. decal.Face = Enum.NormalId.Right
  45. decal.Texture = "http://www.roblox.com/asset/?id=25770106"
  46.  
  47. decal = Instance.new("Decal",handle)
  48. decal.Face = Enum.NormalId.Top
  49. decal.Texture = "http://www.roblox.com/asset/?id=25770136"
  50. function vanish()
  51. for i,v in pairs(handle:GetChildren()) do
  52. if v:IsA("Decal") then
  53. v.Transparency=1
  54. end
  55. end
  56. handle.Transparency=1
  57. end
  58. function unvanish()
  59. for i,v in pairs(handle:GetChildren()) do
  60. if v:IsA("Decal") then
  61. v.Transparency=0
  62. end
  63. end
  64. handle.Transparency=0
  65. end
  66. local equipped=false
  67. local enabled=true
  68. player.Chatted:connect(function(m)
  69. if m=="poke:clear:m" then
  70. for i,v in pairs(balls) do
  71. v:Destroy()
  72. table.remove(balls,i)
  73. end
  74. elseif m=="poke:clear:a" then
  75. for i,v in pairs(workspace:GetChildren()) do
  76. if v:IsA("Part") then
  77. if v.Name=="PokeEntity" then
  78. v:Destroy()
  79. end
  80. end
  81. end
  82. end
  83. end)
  84. tool.Equipped:connect(function() equipped=true end)
  85. tool.Unequipped:connect(function() equipped=false end)
  86. local mouse=player:GetMouse()
  87. local animation=Instance.new("Animation",character)
  88. animation.Name="ThrowA"
  89. animation.AnimationId="http://www.roblox.com/asset?id=30704030"
  90. local animTrack=character.Humanoid:LoadAnimation(animation)
  91. mouse.Button1Down:connect(function()
  92. if equipped and enabled then
  93. --throw
  94.  
  95. local project=handle:Clone()
  96. animTrack:Play()
  97. vanish()
  98. sound:Play()
  99. wait(.5)
  100. project.Parent=workspace
  101. project.CFrame=CFrame.new(character.Torso.Position+character.Torso.CFrame.lookVector*5)
  102. enabled=false
  103. project.Velocity=mouse.Hit.lookVector*300
  104. project.Touched:connect(function(hit)
  105. if hit.Parent:findFirstChild("Humanoid") and hit.Parent:findFirstChild("Torso") then
  106.  
  107. for i,v in pairs(hit.Parent:GetChildren()) do
  108. if v:IsA("Part") then
  109. v.Anchored=true
  110. end
  111. end
  112. local ball=Instance.new("Part",workspace)
  113. ball.Shape="Ball"
  114. ball.Anchored=true
  115. ball.Name="PokeEntity"
  116. ball.BrickColor=BrickColor.new("Really red")
  117. ball.Transparency=0.5
  118. ball.Size=Vector3.new(10,10,10)
  119. ball.CFrame=CFrame.new(hit.Parent.Torso.Position)
  120. ball.TopSurface='Smooth'
  121. ball.BottomSurface='Smooth'
  122. table.insert(balls,ball)
  123. end
  124. local explosion=Instance.new("Explosion",workspace)
  125. explosion.BlastPressure=0
  126. explosion.BlastRadius=0
  127. explosion.DestroyJointRadiusPercent=0
  128. explosion.Position=project.Position
  129. explosion.ExplosionType='NoCraters'
  130. project:Destroy()
  131. end)
  132. wait(2)
  133. enabled=true
  134. unvanish()
  135. end
  136. end)
Add Comment
Please, Sign In to add comment