How do I make a value 0 if it exceeds another value?

Is there any way I could make the value 1 again if its over 3?

Here’s the script:

local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local combo = 0
local maxcombo = 3

mouse.Button1Down:Connect(function()
	combo += 1
	print(combo)
end)

mouse.Button1Up:Connect(function()
	task.wait(5)
	combo = 1
end)

if combo <= maxcombo then
	combo = 0
end

Here’s the output:
erot

local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local combo = 0
local maxcombo = 3

mouse.Button1Down:Connect(function()
    if combo >= maxcombo then
        combo = 1
    else
        combo += 1
    end
	print(combo)
end)

mouse.Button1Up:Connect(function()
	task.wait(5)
	combo = 1
end)

if combo <= maxcombo then
	combo = 0
end
1 Like