Facebook
From Filip KrzemieĊ„, 8 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 195
  1. local player = game.Players.LocalPlayer
  2. local mouse = player:GetMouse()
  3. local tool = script.Parent
  4. local server = tool:WaitForChild("ServerScript")
  5.  
  6. local equipped = false
  7. local spraying = false
  8.  
  9. tool.Equipped:Connect(function ()
  10.  equipped = true
  11. end)
  12.  
  13. tool.Unequipped:Connect(function ()
  14.  equipped = false
  15.  if spraying then
  16.   server.Stop:FireServer()
  17.  end
  18. end)
  19.  
  20. mouse.Button1Down:Connect(function ()
  21.  if equipped == true then
  22.   spraying = true
  23.   server.Start:FireServer()
  24.  end
  25. end)
  26.  
  27. mouse.Button1Up:Connect(function ()
  28.  if equipped == true  then
  29.   spraying = false
  30.   server.Stop:FireServer()
  31.  end
  32. end)