KrYn0MoRe

smoke nade

Nov 27th, 2020 (edited)
921
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 = "Smoke Grenade"
  12. Tool0.Parent = plr:FindFirstChild("Backpack")
  13. Part1.Name = "Handle"
  14. Part1.Parent = Tool0
  15. Part1.Size = Vector3.new(0.682, 1.65, 0.88)
  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://437001004"
  24. SpecialMesh2.Scale = Vector3.new(0.002, 0.002, 0.002)
  25. SpecialMesh2.TextureId = "rbxassetid://437001024"
  26. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  27.  
  28. local tool = Tool0
  29. local handle = Part1
  30.  
  31. local debris = game:GetService("Debris")
  32. local tween = game:GetService("TweenService")
  33.  
  34. local using = false
  35. local equipped = false
  36. local holding = false
  37. local amount = 1/0
  38.  
  39. local junk = script --workspace.junk
  40.  
  41. local hits = {1543854566,1543854764,1543854943,1543855404}
  42. local explosions = {2814354886,2814355346,2814355743,2814354338}
  43.  
  44. function play(id,par,vol,pitch,loop,starting,ending)
  45.     local current = Instance.new("Sound",par)
  46.     current.SoundId = "rbxassetid://" ..id
  47.     current.Parent = par or script
  48.     current.Volume = vol or 1
  49.     current.PlaybackSpeed = pitch or 1
  50.     current.Looped = loop or false
  51.     current:Play()
  52.     current.TimePosition = starting or 0
  53.     spawn(function()
  54.         if ending ~= nil and tonumber(ending) then
  55.             repeat wait() until current.TimePositon >= ending
  56.             current:Stop()
  57.             debris:AddItem(current,1)
  58.         else
  59.             repeat wait() until not current.IsPlaying
  60.             debris:AddItem(current,1)
  61.         end
  62.     end)
  63.     return current
  64. end
  65.  
  66. function smoke(par,pos)
  67.     local Part0 = Instance.new("Part")
  68.     Part0.Parent = par
  69.     Part0.Position = pos
  70.     Part0.Transparency = 1
  71.     Part0.Size = Vector3.new(20, 0.0500000007, 20)
  72.     Part0.Anchored = true
  73.     Part0.BottomSurface = Enum.SurfaceType.Smooth
  74.     Part0.CanCollide = false
  75.     Part0.Material = Enum.Material.Slate
  76.     Part0.TopSurface = Enum.SurfaceType.Smooth
  77.     Part0.FormFactor = Enum.FormFactor.Custom
  78.     Part0.formFactor = Enum.FormFactor.Custom
  79.     local ParticleEmitter0 = Instance.new("ParticleEmitter")
  80.     ParticleEmitter0.Parent = Part0
  81.     ParticleEmitter0.Speed = NumberRange.new(3, 3)
  82.     ParticleEmitter0.Color = ColorSequence.new(Color3.new(0.831373, 0.831373, 0.831373),Color3.new(0.611765, 0.611765, 0.611765))
  83.     ParticleEmitter0.Texture = "http://www.roblox.com/asset/?id=237568993"
  84.     ParticleEmitter0.Size = NumberSequence.new(4,4)
  85.     ParticleEmitter0.Lifetime = NumberRange.new(3, 5)
  86.     ParticleEmitter0.Rate = 100
  87.     ParticleEmitter0.RotSpeed = NumberRange.new(20, 20)
  88.     play('2699499175',Part0,1.5)
  89.     local hitbox = Instance.new("Part",Part0)
  90.     hitbox.Name = "hit box"
  91.     hitbox.Size = Vector3.new(20,10,20)
  92.     hitbox.CanCollide = false
  93.     hitbox.Anchored = true
  94.     hitbox.Transparency = 1
  95.     hitbox.Position = pos + Vector3.new(0,3,0)
  96.     spawn(function()
  97.         ParticleEmitter0.Enabled = true
  98.         wait(14)
  99.         ParticleEmitter0.Enabled = false
  100.         debris:AddItem(Part0,4)
  101.         hitbox:Destroy()
  102.     end)
  103.     spawn(function()
  104.         while hitbox and hitbox.Parent do
  105.             local reg = Region3.new(hitbox.Position-hitbox.Size/2,hitbox.Position+hitbox.Size/2)
  106.             local parts = workspace:FindPartsInRegion3(reg,hitbox,1/0)
  107.             for _,obj in pairs(parts) do
  108.                 if obj.Name == 'fire hit' and obj:IsA("BasePart") and obj.Parent.Name == 'Fire' then
  109.                     obj.Parent:Destroy()
  110.                     play('2699594712',Part0,2)
  111.                 end
  112.             end
  113.             wait(0.2)
  114.         end
  115.     end)
  116. end
  117.  
  118. function throw(mpos)
  119.     local pag = Instance.new("Part")
  120.     pag.Parent = junk
  121.     pag.CanCollide = false
  122.     pag.Transparency = 1
  123.     pag.Anchored = true
  124.     pag.CanCollide = false
  125.     pag.CFrame = CFrame.new(handle.Position,mpos)
  126.    
  127.     --play('2555282633',torso,1)
  128.     play('711753382',handle,1)
  129.  
  130.     local fake = handle:Clone()
  131.     fake.Parent = junk
  132.     fake.Name = "grenade"
  133.     fake.CanCollide = true
  134.     fake.Velocity = pag.CFrame.lookVector * 130
  135.    
  136.     local hit = Instance.new("Sound")
  137.     hit.SoundId = "rbxassetid://" .. tostring(hits[math.random(1,#hits)])
  138.     hit.Parent = fake
  139.     hit.Volume = 1
  140.    
  141.     local bouncing = false
  142.     local activated = false
  143.    
  144.     fake.Touched:Connect(function(obj)
  145.         if obj and not bouncing then
  146.             bouncing = true
  147.             hit.SoundId = "rbxassetid://" .. tostring(hits[math.random(1,#hits)])
  148.             hit:Play()
  149.             spawn(function()
  150.                 wait(.1)
  151.                 bouncing = false
  152.             end)
  153.             if not activated then
  154.                 activated = true
  155.                 spawn(function()
  156.                     wait(2)
  157.                     smoke(junk,fake.Position)
  158.                     fake:Destroy()
  159.                     pag:Destroy()
  160.                 end)
  161.             end
  162.         end
  163.     end)
  164. end
  165.  
  166. tool.Equipped:Connect(function()
  167.     equipped = true
  168. end)
  169. tool.Unequipped:Connect(function()
  170.     equipped = false
  171. end)
  172.  
  173. local remote = script:FindFirstChild('RemoteEvent') or Instance.new("RemoteEvent")
  174. remote.Parent = plr:FindFirstChildOfClass("Backpack")
  175.  
  176. remote.OnServerEvent:Connect(function(lplr,data)
  177.     if plr == lplr and data then else return end
  178.     if equipped and not using then
  179.         using = true
  180.         throw(data)
  181.         amount -= 1
  182.         if 0 >= amount then
  183.             tool:Destroy()
  184.         end
  185.         wait(0.25)
  186.         using = false
  187.     end
  188. end)
  189.  
  190. NLS([[
  191. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  192. local remote = script.Parent
  193. mouse.Button1Down:Connect(function()
  194.     remote:FireServer(mouse.Hit.p)
  195. end)
  196. ]],remote)
RAW Paste Data