Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner
- local char = plr.Character
- local hum = char:FindFirstChildOfClass("Humanoid")
- local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
- wait(0.1)
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Tool0.Name = "Explosive Grenade"
- Tool0.CanBeDropped = false
- Tool0.Parent = plr:FindFirstChild("Backpack")
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.Size = Vector3.new(0.798, 1.037, 0.791)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.Anchored = false
- Part1.CanCollide = false
- Part1.Material = Enum.Material.SmoothPlastic
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Shape = Enum.PartType.Block
- Part1.CustomPhysicalProperties = PhysicalProperties.new(0.699999988, 1.5, 0.5, 2, 1)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "rbxassetid://454821348"
- SpecialMesh2.Scale = Vector3.new(0.002, 0.002, 0.002)
- SpecialMesh2.TextureId = "rbxassetid://454821354"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- local tool = Tool0
- local handle = Part1
- local debris = game:GetService("Debris")
- local tween = game:GetService("TweenService")
- local using = false
- local equipped = false
- local holding = false
- local amount = 1/0
- local junk = script --workspace.junk
- local hits = {1543854566,1543854764,1543854943,1543855404}
- local explosions = {2814354886,2814355346,2814355743,2814354338}
- function play(id,par,vol,pitch,loop,starting,ending)
- local current = Instance.new("Sound",par)
- current.SoundId = "rbxassetid://" ..id
- current.Parent = par or script
- current.Volume = vol or 1
- current.PlaybackSpeed = pitch or 1
- current.Looped = loop or false
- current:Play()
- current.TimePosition = starting or 0
- spawn(function()
- if ending ~= nil and tonumber(ending) then
- repeat wait() until current.TimePositon >= ending
- current:Stop()
- debris:AddItem(current,1)
- else
- repeat wait() until not current.IsPlaying
- debris:AddItem(current,1)
- end
- end)
- return current
- end
- local degrees = {
- CFrame.Angles(math.rad(45),math.rad(0),math.rad(0)),
- CFrame.Angles(math.rad(45),math.rad(45),math.rad(0)),
- CFrame.Angles(math.rad(0),math.rad(0),math.rad(45)),
- CFrame.Angles(math.rad(45),math.rad(0),math.rad(45)),
- CFrame.Angles(math.rad(45),math.rad(45),math.rad(0)),
- CFrame.Angles(math.rad(0),math.rad(45),math.rad(45)),
- CFrame.Angles(math.rad(45),math.rad(45),math.rad(45)),
- }
- local blacklisted = {
- 'Base',
- 'Baseplate',
- }
- function make_crater(size,cf,mode,ig)
- local subtract = {}
- if mode == 1 then
- for i = 1,#degrees do
- local p = Instance.new("Part")
- p.Size = Vector3.new(size,size,size)
- p.Shape = Enum.PartType.Block
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 0.5
- local angle = degrees[i]
- angle = math.random()
- p.CFrame = cf*angle
- p.Parent = game.Lighting
- table.insert(subtract,1,p)
- end
- elseif mode == 2 then
- for i = 1,1 do
- local p = Instance.new("Part")
- p.Size = Vector3.new(size,size,size)
- p.Shape = Enum.PartType.Ball
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 0.5
- p.CFrame = cf
- p.Parent = game.Lighting
- table.insert(subtract,1,p)
- end
- elseif mode == 3 then
- for i = 1,10 do
- local p = Instance.new("Part")
- p.Size = Vector3.new(size,size,size)
- p.Shape = Enum.PartType.Block
- p.Anchored = true
- p.CanCollide = false
- p.Transparency = 0.5
- local angle = CFrame.Angles(math.rad(math.random()*180),math.rad(math.random()*180),math.rad(math.random()*180))
- p.CFrame = cf*angle
- p.Parent = game.Lighting
- table.insert(subtract,1,p)
- end
- end
- assert(#subtract > 0,'No parts to union.')
- local region = Region3.new(cf.p-Vector3.new(size,size,size)/2,cf.p+Vector3.new(size,size,size)/2)
- local parts = workspace:FindPartsInRegion3WithIgnoreList(region,{unpack(subtract),unpack(ig)},1/0)
- for _,v in ipairs(parts) do
- if v and v:IsA("BasePart") and not v.Parent:IsA("Accessory") and not v.Parent:FindFirstChildOfClass("Humanoid") and not table.find(blacklisted,v.Name) then
- coroutine.wrap(function()
- local par = v.Parent
- v.Parent = game:GetService("Lighting")
- local union
- local success = pcall(function()
- union = v:SubtractAsync(subtract,Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Precise)
- end)
- if not union or not success then
- v:Destroy()
- return
- end
- union.Name = v.Name
- union.Anchored = v.Anchored
- union.CanCollide = v.CanCollide
- for _,vv in pairs(v:GetChildren()) do
- vv.Parent = union
- end
- v:Destroy()
- union.Parent = par
- end)()
- end
- end
- for i,v in ipairs(subtract) do v:Destroy() end
- end
- function bang(par,pos)
- local Part0 = Instance.new("Part")
- local ParticleEmitter1 = Instance.new("ParticleEmitter")
- Part0.Name = "grenade"
- Part0.Parent = par
- Part0.Position = pos
- Part0.Transparency = 1
- Part0.Size = Vector3.new(4, 0.0500000007, 4)
- Part0.Anchored = true
- Part0.BottomSurface = Enum.SurfaceType.Smooth
- Part0.CanCollide = false
- Part0.Locked = true
- Part0.TopSurface = Enum.SurfaceType.Smooth
- ParticleEmitter1.Parent = Part0
- ParticleEmitter1.Speed = NumberRange.new(20,30)
- ParticleEmitter1.Color = ColorSequence.new(Color3.new(1,1,1),Color3.new(1,1,1))
- ParticleEmitter1.Enabled = false
- ParticleEmitter1.LightEmission = 0.80000001192093
- ParticleEmitter1.Texture = "rbxassetid://3607612871"
- ParticleEmitter1.Size = NumberSequence.new(3,0.5)
- ParticleEmitter1.Lifetime = NumberRange.new(0.80000001192093, 0.80000001192093)
- ParticleEmitter1.LockedToPart = true
- ParticleEmitter1.Rate = 10000
- ParticleEmitter1.RotSpeed = NumberRange.new(270, 270)
- ParticleEmitter1.SpreadAngle = Vector2.new(-90, -90)
- ParticleEmitter1.VelocitySpread = -90
- play(explosions[math.random(1,#explosions)],Part0,1)
- local ex = Instance.new("Explosion")
- ex.Parent = junk
- ex.Visible = false
- ex.Position = pos
- ex.DestroyJointRadiusPercent = 0
- ex.BlastRadius = 20
- ex.BlastPressure = 0
- spawn(function()
- make_crater(20/2,CFrame.new(pos),3,{Part0,par})
- end)
- ex.Hit:connect(function(obj, Distance)
- if ex.BlastRadius >= Distance then else return end
- local targchar,tarhum,targtorso,targhead
- pcall(function()
- targchar = obj.Parent
- end)
- pcall(function()
- tarhum = targchar:FindFirstChildOfClass("Humanoid")
- end)
- pcall(function()
- targtorso = targchar:FindFirstChild("HumanoidRootPart") or targchar:FindFirstChild("Torso")
- end)
- pcall(function()
- targhead = targchar:FindFirstChild("Head")
- end)
- if targchar and targhead --[[and (targplr.TeamColor ~= plr.TeamColor or targplr == plr)]] and tarhum and tarhum.Parent and targtorso and targtorso.Parent then
- local p1 = pos+Vector3.new(0,1,0)
- local p2 = (targhead.Position-p1)
- local chars = {}
- for i,v in pairs(workspace:GetChildren()) do
- local targchar2,tarhum2,targtorso2
- pcall(function()
- targchar2 = obj.Parent
- end)
- pcall(function()
- tarhum2 = targchar2:FindFirstChildOfClass("Humanoid")
- end)
- pcall(function()
- targtorso2 = targchar2:FindFirstChild("HumanoidRootPart") or targchar2:FindFirstChild("Torso")
- end)
- if targchar2 and tarhum2 and tarhum2.Parent and targtorso2 and targtorso2.Parent then
- table.insert(chars,#chars+1,targchar2)
- end
- end
- local params = RaycastParams.new()
- params.IgnoreWater = true
- params.FilterType = Enum.RaycastFilterType.Blacklist
- params.FilterDescendantsInstances = {script,Part0,targchar,unpack(chars),junk}
- local blocked = false
- local hit = workspace:Raycast(
- p1,
- p2.Unit*p2.Magnitude,
- params
- )
- if hit and 0.5 > hit.Instance.Transparency then
- --[[
- print(hit)
- local paa = Instance.new("Part",workspace)
- paa.Size = Vector3.new(1,1,1)
- paa.CanCollide = false
- paa.Anchored = true
- paa.Transparency = 0
- paa.Position = hit.Position
- ]]
- blocked = true
- end
- if not blocked and not tarhum:FindFirstChild("hit grenade " .. plr.Name) then
- local cval = Instance.new("ObjectValue",tarhum)
- cval.Name = ("hit grenade " .. plr.Name)
- cval.Parent = tarhum
- game:GetService("Debris"):AddItem(cval,0.3)
- tarhum:TakeDamage((1-(Distance/ex.BlastRadius))*150)
- if 0 >= tarhum.Health and not tarhum:FindFirstChild("killer") then
- local tempkillval = Instance.new("ObjectValue",tarhum)
- tempkillval.Name = "killer"
- tempkillval.Value = plr
- end
- end
- end
- end)
- spawn(function()
- ParticleEmitter1.Enabled = true
- wait(.25)
- ParticleEmitter1.Enabled = false
- debris:AddItem(Part0,1)
- debris:AddItem(ex,1)
- end)
- end
- function throw(mpos)
- local pag = Instance.new("Part")
- pag.Parent = junk
- pag.CanCollide = false
- pag.Transparency = 1
- pag.Anchored = true
- pag.CanCollide = false
- pag.CFrame = CFrame.new(handle.Position,mpos)
- --play('2552683979',torso,1)
- play('711753382',handle,1)
- local fake = handle:Clone()
- fake.Parent = junk
- fake.Name = "grenade"
- fake.CanCollide = true
- fake.Velocity = pag.CFrame.lookVector * 130
- local hit = Instance.new("Sound")
- hit.SoundId = "rbxassetid://" .. tostring(hits[math.random(1,#hits)])
- hit.Parent = fake
- hit.Volume = 1
- local bouncing = false
- local activated = false
- fake.Touched:Connect(function(obj)
- if obj and not bouncing then
- bouncing = true
- hit.SoundId = "rbxassetid://2552566004"-- .. tostring(hits[math.random(1,#hits)])
- hit:Play()
- spawn(function()
- wait(.1)
- bouncing = false
- end)
- if not activated then
- activated = true
- spawn(function()
- wait(2)
- bang(junk,fake.Position)
- fake:Destroy()
- pag:Destroy()
- end)
- end
- end
- end)
- end
- tool.Equipped:Connect(function()
- equipped = true
- end)
- tool.Unequipped:Connect(function()
- equipped = false
- end)
- local remote = script:FindFirstChild('RemoteEvent') or Instance.new("RemoteEvent")
- remote.Parent = plr:FindFirstChildOfClass("Backpack")
- remote.OnServerEvent:Connect(function(lplr,data)
- if plr == lplr and data then else return end
- if equipped and not using then
- using = true
- throw(data)
- amount -= 1
- if 0 >= amount then
- tool:Destroy()
- end
- wait(0.25)
- using = false
- end
- end)
- NLS([[
- local mouse = game:GetService("Players").LocalPlayer:GetMouse()
- local remote = script.Parent
- mouse.Button1Down:Connect(function()
- remote:FireServer(mouse.Hit.p)
- end)
- ]],remote)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement