Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. --tyler
  2. localplayer=game.Players.LocalPlayer
  3. localcharacter=localplayer.Character
  4. localhumanoid=localcharacter.Humanoid
  5. local reloads={slingshot=0.2,rocket=7,bomb=5,dodgeball=2}
  6. local data={slingshot={ready=true,lastactivation=0},rocket={ready=true,lastactivation=0},bomb={ready=true,lastactivation=0},dodgeball={ready=true,lastactivation=0}}
  7. local immuneplrs={localplayer.Name}
  8. local connections={}
  9. function findt(tn)
  10. return localplayer.Backpack:FindFirstChild(tn) or localcharacter:FindFirstChild(tn)
  11. end
  12. local charweps={["Slingshot"]=findt('2 Slingshot'),["Rocket"]=findt('3 Rocket'),["Bomb"]=findt('5 Bomb'),["Superball"]=findt('6 Superball')}
  13. function unhookall()
  14. for i,c in pairs(connections) do
  15. if (c~=nil) then
  16. c:disconnect()
  17. table.remove(c,i)
  18. end
  19. end
  20. end
  21. function ranwep()
  22. local selwep=nil
  23. for wn,wi in pairs(charweps) do
  24. if wi~=nil then
  25. if data[wn].ready==true then
  26. selwep=wi
  27. break
  28. end
  29. end
  30. end
  31. return selwep
  32. end
  33. function ranplr()
  34. local li=game.Players:GetPlayers()
  35. local ran=li[math.random(1,#li)]
  36. local function immuneornot()
  37. local immune=false
  38. for _,immunep in pairs(immuneplrs) do
  39. if immunep==ran.Name then
  40. immune=true
  41. break
  42. end
  43. end
  44. return immune
  45. end
  46. local function worth()
  47. local suitable=false
  48. if ran~=nil and immuneornot()==false then
  49. local c=ran.Character
  50. if c~=nil and c:FindFirstChildWhichIsA('ForceField',true)==nil then
  51. local h=c:FindFirstChildWhichIsA('Humanoid')
  52. if h~=nil and h.Health>0 then
  53. suitable=true
  54. end
  55. end
  56. end
  57. return suitable
  58. end
  59. repeat
  60. ran=li[math.random(1,#li)]
  61. wait()
  62. until immuneornot()==true
  63. return ran
  64. end
  65. function ProjectileTrackCharacter(p,c)
  66. math.randomseed(tick())
  67. local co=('lilxan'..tostring(math.random(22,4832)))
  68. if c~=nil then
  69. local h=c:FindFirstChildWhichIsA('Humanoid')
  70. if h~=nil then
  71. connections[co]=game:service('RunService').RenderStepped:connect(function()
  72. if p==nil or c.Parent==nil or h.Health==0 and connections[co]~=nil then
  73. connections[co]:disconnect()
  74. connections[co]=nil
  75. end
  76. p.CFrame=c:GetPrimaryPartCFrame()
  77. end)
  78. end
  79. end
  80. end
  81. function FireWeapon(w)
  82. local buff=w:FindFirstChildWhichIsA('ObjectValue')
  83. local ran=ranplr()
  84. if buff~=nil and buff.Value~=nil and ran~=nil then
  85. local p=buff.Value
  86. local m=localplayer:GetMouse()
  87. local remoteevent=w:FindFirstChild('ClearValueEvent')
  88. local thepos=ran.Character:GetPrimaryPartCFrame()-Vector3.new(0,1.5,0)
  89. if m~=nil and remoteevent~=nil then
  90. local hit=m.Hit.p
  91. local head=localcharacter:FindFirstChild('Head')
  92. if head~=nil then
  93. local LookAt=(hit-head.Position).unit
  94. local thepos2=localcharacter.PrimaryPart.Position + (LookAt * 5)
  95. local f=p:FindFirstChildWhichIsA('BodyForce') or Instance.new('BodyForce')
  96. f.Force=Vector3.new(0,p:getMass()*game.Workspace.Gravity,0)
  97. f.Parent=p
  98. p.Parent=game.Workspace
  99. if w.Name~=('5 Bomb') and w.Name~=('3 Rocket') then
  100. p.CFrame=thepos
  101. else
  102. ProjectileTrackCharacter(p,ran.Character)
  103. end
  104. remoteevent:FireServer()
  105. local wn=string.sub(w.Name,3)
  106. data[wn].ready=false
  107. data[wn].lastactivation=time()
  108. coroutine.resume(coroutine.create(function()
  109. wait(reloads[wn])
  110. data[wn].ready=true
  111. end))
  112. end
  113. end
  114. end
  115. end
  116. localhumanoid.Died:connect(unhookall)
  117. while localhumanoid.Health>0 and wait() do
  118. if localhumanoid:FindFirstChildWhichIsA('ForceField',true)~=nil then
  119. return
  120. end
  121. local LoadedWeapon=ranwep()
  122. if LoadedWeapon==nil then
  123. repeat
  124. LoadedWeapon=ranwep()
  125. wait()
  126. until LoadedWeapon~=nil
  127. end
  128. localhumanoid:EquipTool(LoadedWeapon)
  129. repeat wait() until localcharacter:FindFirstChildWhichIsA('Tool')~=nil
  130. FireWeapon(LoadedWeapon)
  131. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement