Advertisement
giganciprogramowania

l16 ServerScript

May 22nd, 2023
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. local runService = game:GetService("RunService")
  2.  
  3.  
  4. local tool = script.Parent
  5. local handle = tool.Handle
  6. local spraySound = handle.SpraySound
  7. local sprayParticle = handle.Nozzle.SprayParticle
  8.  
  9.  
  10. local shooting = false
  11. local shootTimer = 0
  12.  
  13.  
  14. local player
  15.  
  16.  
  17. script.Parent.Equipped:Connect(function()
  18. local found = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
  19. if found ~= nil then
  20. player = found
  21. end
  22. end)
  23.  
  24.  
  25. script.Start.OnServerEvent:Connect(function(sender)
  26. if sender == player then
  27. shooting = true
  28.  
  29.  
  30. spraySound.TimePosition = 0
  31. spraySound:Play()
  32. sprayParticle.Enabled = true
  33.  
  34.  
  35. shootTimer = 0
  36. end
  37. end)
  38.  
  39.  
  40. script.Stop.OnServerEvent:Connect(function(sender)
  41. if sender == player then
  42. shooting = false
  43. spraySound.TimePosition = 2.6
  44. sprayParticle.Enabled = false
  45.  
  46.  
  47. local nozzle = handle.Nozzle
  48. local newNozzle = nozzle:Clone()
  49. newNozzle.Parent = handle
  50. nozzle.Parent = workspace.Terrain
  51. nozzle.Position = Vector3.new(0, -10000, 0)
  52. sprayParticle = newNozzle.SprayParticle
  53.  
  54.  
  55. game:GetService("Debris"):AddItem(nozzle, 5)
  56. end
  57. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement