KrYn0MoRe

incendiary nade

Nov 27th, 2020 (edited)
812
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local plr = owner
  2. local char = plr.Character
  3. local hum = char:FindFirstChildOfClass("Humanoid")
  4. local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  5.  
  6. wait(0.1)
  7.  
  8. Tool0 = Instance.new("Tool")
  9. Part1 = Instance.new("Part")
  10. SpecialMesh2 = Instance.new("SpecialMesh")
  11. Tool0.Name = "Incendiary Grenade"
  12. Tool0.Parent = plr:FindFirstChild("Backpack")
  13. Part1.Name = "Handle"
  14. Part1.Parent = Tool0
  15. Part1.Size = Vector3.new(0.579, 1.402, 0.627)
  16. Part1.Material = Enum.Material.SmoothPlastic
  17. Part1.BottomSurface = Enum.SurfaceType.Smooth
  18. Part1.Anchored = false
  19. Part1.CanCollide = false
  20. Part1.TopSurface = Enum.SurfaceType.Smooth
  21. Part1.CustomPhysicalProperties = PhysicalProperties.new(0.699999988, 1.5, 0.5, 2, 1)
  22. SpecialMesh2.Parent = Part1
  23. SpecialMesh2.MeshId = "rbxassetid://454822101"
  24. SpecialMesh2.Scale = Vector3.new(0.003, 0.003, 0.003)
  25. SpecialMesh2.TextureId = "rbxassetid://454822102"
  26. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  27.  
  28. local tool = Tool0
  29. local handle = Part1
  30.  
  31. local id = math.random(-999999,999999)
  32.  
  33. local debris = game:GetService("Debris")
  34. local tween = game:GetService("TweenService")
  35.  
  36. local using = false
  37. local equipped = false
  38. local holding = false
  39. local amount = 1/0
  40.  
  41. local junk = script --workspace.junk
  42.  
  43. local hits = {1543854566,1543854764,1543854943,1543855404}
  44. local explosions = {2814354886,2814355346,2814355743,2814354338}
  45.  
  46. function play(id,par,vol,pitch,loop,starting,ending)
  47.     local current = Instance.new("Sound",par)
  48.     current.SoundId = "rbxassetid://" ..id
  49.     current.Parent = par or script
  50.     current.Volume = vol or 1
  51.     current.PlaybackSpeed = pitch or 1
  52.     current.Looped = loop or false
  53.     current:Play()
  54.     current.TimePosition = starting or 0
  55.     spawn(function()
  56.         if ending ~= nil and tonumber(ending) then
  57.             repeat wait() until current.TimePositon >= ending
  58.             current:Stop()
  59.             debris:AddItem(current,1)
  60.         else
  61.             repeat wait() until not current.IsPlaying
  62.             debris:AddItem(current,1)
  63.         end
  64.     end)
  65.     return current
  66. end
  67.  
  68. local hitsound2 = Instance.new("Sound")
  69. hitsound2.SoundId = 'rbxassetid://3362346832'
  70. hitsound2.Volume = 1
  71. hitsound2.Parent = handle
  72.  
  73. function effect(par,tarhum,weld,cid)
  74.     if not par:FindFirstChild(plr.Name .. 'fire dmg' .. cid) then
  75.         local fireconfirm = Instance.new("IntValue",par)
  76.         fireconfirm.Name = (plr.Name .. 'fire dmg' .. cid)
  77.         fireconfirm.Parent = par
  78.         debris:AddItem(fireconfirm,0.2)
  79.         for i,v in pairs(par:GetChildren()) do
  80.             if (v:IsA("Part") or v:IsA("WedgePart") or v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("UnionOperation")) and v.Name ~= "effects" then
  81.                 local fire = Instance.new("Fire")
  82.                 fire.Parent = v
  83.                 debris:AddItem(fire,0.2)
  84.             end
  85.         end
  86.         local clonehit = hitsound2:Clone()
  87.         clonehit.Parent = weld
  88.         clonehit:Play()
  89.         tarhum:TakeDamage(8)
  90.         if 0 >= tarhum.Health and not tarhum:FindFirstChild("killer") then
  91.             local tempkillval = Instance.new("ObjectValue",tarhum)
  92.             tempkillval.Name = "killer"
  93.             tempkillval.Value = plr
  94.         end
  95.     end
  96. end
  97.  
  98. function boom(par,pos,cid)
  99.     local Part0 = Instance.new("Part")
  100.     local ParticleEmitter1 = Instance.new("ParticleEmitter")
  101.     local ParticleEmitter2 = Instance.new("ParticleEmitter")
  102.     Part0.Name = "Fire"
  103.     Part0.Parent = par
  104.     Part0.Position = pos
  105.     Part0.Transparency = 1
  106.     Part0.Size = Vector3.new(20, 0.0500000007, 20)
  107.     Part0.Anchored = true
  108.     Part0.BottomSurface = Enum.SurfaceType.Smooth
  109.     Part0.CanCollide = false
  110.     Part0.Material = Enum.Material.Slate
  111.     Part0.TopSurface = Enum.SurfaceType.Smooth
  112.     Part0.FormFactor = Enum.FormFactor.Custom
  113.     Part0.formFactor = Enum.FormFactor.Custom
  114.     ParticleEmitter1.Parent = Part0
  115.     ParticleEmitter1.Speed = NumberRange.new(5, 7)
  116.     ParticleEmitter1.Rotation = NumberRange.new(4, 9)
  117.     ParticleEmitter1.Color = ColorSequence.new(Color3.new(1, 0.333333, 0),Color3.new(0.364706, 0, 0))
  118.     ParticleEmitter1.LightEmission = 0.86000001430511
  119.     ParticleEmitter1.Texture = "http://www.roblox.com/asset/?id=248625108"
  120.     ParticleEmitter1.Transparency = NumberSequence.new(0,0.54374998807907,0.73749995231628,0,0.72500002384186,0.45625001192093,0.63749998807907,0,0.52499997615814,0)
  121.     ParticleEmitter1.Size = NumberSequence.new(0.30000001192093,0.30000001192093)
  122.     ParticleEmitter1.Lifetime = NumberRange.new(50, 50)
  123.     ParticleEmitter1.LockedToPart = true
  124.     ParticleEmitter1.Rate = 70
  125.     ParticleEmitter1.RotSpeed = NumberRange.new(5, 9)
  126.     ParticleEmitter1.SpreadAngle = Vector2.new(28, 28)
  127.     ParticleEmitter1.VelocitySpread = 28
  128.     ParticleEmitter2.Parent = Part0
  129.     ParticleEmitter2.Speed = NumberRange.new(5, 7)
  130.     ParticleEmitter2.Rotation = NumberRange.new(4, 9)
  131.     ParticleEmitter2.Color = ColorSequence.new(Color3.new(1, 0.333333, 0),Color3.new(0.364706, 0, 0))
  132.     ParticleEmitter2.LightEmission = 0.86000001430511
  133.     ParticleEmitter2.Texture = "http://www.roblox.com/asset/?id=248625108"
  134.     ParticleEmitter2.Transparency = NumberSequence.new(0,0.54374998807907,0.73749995231628,0,0.72500002384186,0.45625001192093,0.63749998807907,0,0.52499997615814,0)
  135.     ParticleEmitter2.Size = NumberSequence.new(3.3125,2.8125,2.6875,2.5624995231628,2.3125,2.1875,1.7500001192093,0.43749988079071,0.12499988079071)
  136.     ParticleEmitter2.Lifetime = NumberRange.new(2, 2)
  137.     ParticleEmitter2.LockedToPart = true
  138.     ParticleEmitter2.Rate = 70
  139.     ParticleEmitter2.RotSpeed = NumberRange.new(5, 9)
  140.     ParticleEmitter2.SpreadAngle = Vector2.new(28, 28)
  141.     ParticleEmitter2.VelocitySpread = 28
  142.     play(explosions[math.random(1,#explosions)],Part0,1)
  143.     local fire = play('269252174',Part0,2,1,true)
  144.     debris:AddItem(fire,8)
  145.     local hitbox = Instance.new("Part",Part0)
  146.     hitbox.Name = "fire hit"
  147.     hitbox.Size = Vector3.new(20,10,20)
  148.     hitbox.CanCollide = false
  149.     hitbox.Anchored = true
  150.     hitbox.Transparency = 1
  151.     hitbox.Position = pos + Vector3.new(0,3,0)
  152.     spawn(function()
  153.         ParticleEmitter1.Enabled = true
  154.         ParticleEmitter2.Enabled = true
  155.         wait(7.5)
  156.         ParticleEmitter1.Enabled = false
  157.         ParticleEmitter2.Enabled = false
  158.         debris:AddItem(Part0,8)
  159.         hitbox:Destroy()
  160.     end)
  161.     spawn(function()
  162.         while hitbox and hitbox.Parent do
  163.             local reg = Region3.new(hitbox.Position-hitbox.Size/2,hitbox.Position+hitbox.Size/2)
  164.             local parts = workspace:FindPartsInRegion3(reg,hitbox,1/0)
  165.             for _,obj in pairs(parts) do
  166.                 local targchar,tarhum,targtorso
  167.                 pcall(function()
  168.                     targchar = obj.Parent
  169.                 end)
  170.                 pcall(function()
  171.                     tarhum = targchar:FindFirstChildOfClass("Humanoid")
  172.                 end)
  173.                 pcall(function()
  174.                     targtorso = targchar:FindFirstChild("HumanoidRootPart") or targchar:FindFirstChild("Torso")
  175.                 end)
  176.                 if targchar and tarhum and tarhum.Parent and targtorso and targtorso.Parent then
  177.                     if not targchar:FindFirstChild(plr.Name .. 'fire dmg' .. cid) and obj.Parent:IsA("Model") then
  178.                         effect(targchar,tarhum,obj.Parent.PrimaryPart,cid)
  179.                     end
  180.                 end
  181.             end
  182.             wait(0.2)
  183.         end
  184.     end)
  185. end
  186.  
  187. function throw(mpos)
  188.     id = id + 1
  189.     local cid = id
  190.     local pag = Instance.new("Part")
  191.     pag.Parent = junk
  192.     pag.CanCollide = false
  193.     pag.Transparency = 1
  194.     pag.Anchored = true
  195.     pag.CanCollide = false
  196.     pag.CFrame = CFrame.new(handle.Position,mpos)
  197.    
  198.     --play('2555281965',torso,1)
  199.     play('711753382',handle,1)
  200.  
  201.     local fake = handle:Clone()
  202.     fake.Parent = junk
  203.     fake.Name = "grenade"
  204.     fake.CanCollide = true
  205.     fake.Velocity = pag.CFrame.lookVector * 130
  206.    
  207.     local hit = Instance.new("Sound")
  208.     hit.SoundId = "rbxassetid://" .. tostring(hits[math.random(1,#hits)])
  209.     hit.Parent = fake
  210.     hit.Volume = 1
  211.    
  212.     local bouncing = false
  213.     local activated = false
  214.    
  215.     fake.Touched:Connect(function(obj)
  216.         if obj and not bouncing then
  217.             bouncing = true
  218.             hit.SoundId = "rbxassetid://" .. tostring(hits[math.random(1,#hits)])
  219.             hit:Play()
  220.             spawn(function()
  221.                 wait(.1)
  222.                 bouncing = false
  223.             end)
  224.             if not activated then
  225.                 activated = true
  226.                 spawn(function()
  227.                     wait(2)
  228.                     boom(junk,fake.Position,cid)
  229.                     fake:Destroy()
  230.                     pag:Destroy()
  231.                 end)
  232.             end
  233.         end
  234.     end)
  235. end
  236.  
  237. tool.Equipped:Connect(function()
  238.     equipped = true
  239. end)
  240. tool.Unequipped:Connect(function()
  241.     equipped = false
  242. end)
  243.  
  244. local remote = script:FindFirstChild('RemoteEvent') or Instance.new("RemoteEvent")
  245. remote.Parent = plr:FindFirstChildOfClass("Backpack")
  246.  
  247. remote.OnServerEvent:Connect(function(lplr,data)
  248.     if plr == lplr and data then else return end
  249.     if equipped and not using then
  250.         using = true
  251.         throw(data)
  252.         amount -= 1
  253.         if 0 >= amount then
  254.             tool:Destroy()
  255.         end
  256.         wait(0.25)
  257.         using = false
  258.     end
  259. end)
  260.  
  261. NLS([[
  262. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  263. local remote = script.Parent
  264. mouse.Button1Down:Connect(function()
  265.     remote:FireServer(mouse.Hit.p)
  266. end)
  267. ]],remote)
RAW Paste Data