Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I reset the combo when player doesn't press again after awhile?

I tried using spawn() to reset the timer but it sometimes resets even when I click before it resets

local combo = 1

UIS.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 and equipped then
		spawn(function() -- Reset combo
			wait(0.5)
			combo = 1
		end)
		if combo == 1 then
			combo = 2
			PlayL1:Play()
			local x = Instance.new("BodyPosition", Hrp)
			x.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			x.Position = Hrp.Position
			game:GetService("Debris"):AddItem(x, 0.3)
		elseif combo == 2 then
			combo = 1
			PlayL2:Play()
			local x = Instance.new("BodyPosition", Hrp)
			x.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			x.Position = Hrp.Position
			game:GetService("Debris"):AddItem(x, 0.3)
		end
	end
end)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.