View difference between Paste ID: E7JV1FEZ and iMd6YzsJ
SHOW: | | - or go back to the newest paste.
1
local player = game.Players.LocalPlayer
2
local mouse = player:GetMouse()
3
4
5
local tool = script.Parent
6
local server = tool:WaitForChild("ServerScript")
7
8
9
local equipped = false
10
local spraying = false
11
12
13
tool.Equipped:Connect(function()
14
    equipped = true
15
end)
16
17
18
tool.Unequipped:Connect(function()
19
    equipped = false
20
21
22
    if spraying then
23
        server.Stop:FireServer()
24
    end
25
end)
26
27
28
mouse.Button1Down:Connect(function()
29
    if equipped then
30
        spraying = true
31
        server.Start:FireServer()
32
    end
33
end)
34
35
36
mouse.Button1Up:Connect(function()
37
    if equipped then
38
        spraying = false
39
        server.Stop:FireServer()
40
    end
41
end)