Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --tyler
- localplayer=game.Players.LocalPlayer
- localcharacter=localplayer.Character
- localhumanoid=localcharacter.Humanoid
- local reloads={slingshot=0.2,rocket=7,bomb=5,dodgeball=2}
- local data={slingshot={ready=true,lastactivation=0},rocket={ready=true,lastactivation=0},bomb={ready=true,lastactivation=0},dodgeball={ready=true,lastactivation=0}}
- local immuneplrs={localplayer.Name}
- local connections={}
- function findt(tn)
- return localplayer.Backpack:FindFirstChild(tn) or localcharacter:FindFirstChild(tn)
- end
- local charweps={["Slingshot"]=findt('2 Slingshot'),["Rocket"]=findt('3 Rocket'),["Bomb"]=findt('5 Bomb'),["Superball"]=findt('6 Superball')}
- function unhookall()
- for i,c in pairs(connections) do
- if (c~=nil) then
- c:disconnect()
- table.remove(c,i)
- end
- end
- end
- function ranwep()
- local selwep=nil
- for wn,wi in pairs(charweps) do
- if wi~=nil then
- if data[wn].ready==true then
- selwep=wi
- break
- end
- end
- end
- return selwep
- end
- function ranplr()
- local li=game.Players:GetPlayers()
- local ran=li[math.random(1,#li)]
- local function immuneornot()
- local immune=false
- for _,immunep in pairs(immuneplrs) do
- if immunep==ran.Name then
- immune=true
- break
- end
- end
- return immune
- end
- local function worth()
- local suitable=false
- if ran~=nil and immuneornot()==false then
- local c=ran.Character
- if c~=nil and c:FindFirstChildWhichIsA('ForceField',true)==nil then
- local h=c:FindFirstChildWhichIsA('Humanoid')
- if h~=nil and h.Health>0 then
- suitable=true
- end
- end
- end
- return suitable
- end
- repeat
- ran=li[math.random(1,#li)]
- wait()
- until immuneornot()==true
- return ran
- end
- function ProjectileTrackCharacter(p,c)
- math.randomseed(tick())
- local co=('lilxan'..tostring(math.random(22,4832)))
- if c~=nil then
- local h=c:FindFirstChildWhichIsA('Humanoid')
- if h~=nil then
- connections[co]=game:service('RunService').RenderStepped:connect(function()
- if p==nil or c.Parent==nil or h.Health==0 and connections[co]~=nil then
- connections[co]:disconnect()
- connections[co]=nil
- end
- p.CFrame=c:GetPrimaryPartCFrame()
- end)
- end
- end
- end
- function FireWeapon(w)
- local buff=w:FindFirstChildWhichIsA('ObjectValue')
- local ran=ranplr()
- if buff~=nil and buff.Value~=nil and ran~=nil then
- local p=buff.Value
- local m=localplayer:GetMouse()
- local remoteevent=w:FindFirstChild('ClearValueEvent')
- local thepos=ran.Character:GetPrimaryPartCFrame()-Vector3.new(0,1.5,0)
- if m~=nil and remoteevent~=nil then
- local hit=m.Hit.p
- local head=localcharacter:FindFirstChild('Head')
- if head~=nil then
- local LookAt=(hit-head.Position).unit
- local thepos2=localcharacter.PrimaryPart.Position + (LookAt * 5)
- local f=p:FindFirstChildWhichIsA('BodyForce') or Instance.new('BodyForce')
- f.Force=Vector3.new(0,p:getMass()*game.Workspace.Gravity,0)
- f.Parent=p
- p.Parent=game.Workspace
- if w.Name~=('5 Bomb') and w.Name~=('3 Rocket') then
- p.CFrame=thepos
- else
- ProjectileTrackCharacter(p,ran.Character)
- end
- remoteevent:FireServer()
- local wn=string.sub(w.Name,3)
- data[wn].ready=false
- data[wn].lastactivation=time()
- coroutine.resume(coroutine.create(function()
- wait(reloads[wn])
- data[wn].ready=true
- end))
- end
- end
- end
- end
- localhumanoid.Died:connect(unhookall)
- while localhumanoid.Health>0 and wait() do
- if localhumanoid:FindFirstChildWhichIsA('ForceField',true)~=nil then
- return
- end
- local LoadedWeapon=ranwep()
- if LoadedWeapon==nil then
- repeat
- LoadedWeapon=ranwep()
- wait()
- until LoadedWeapon~=nil
- end
- localhumanoid:EquipTool(LoadedWeapon)
- repeat wait() until localcharacter:FindFirstChildWhichIsA('Tool')~=nil
- FireWeapon(LoadedWeapon)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement