Combo reset script issue?

im making a combat reset script and i found a solution that i understood on teh dev forum. The problem is the script wont run and im not exactly sure what the issue is.

heres the code

		local Tick = RS.Stepped:Wait()
		if Tick - lastAttackTick < resetTime then -- Check if they clicked within the AttackChainResetThreshold value
			if count == 1 then
				local check1 = event:InvokeServer({1, "Start"})
				if check1 == "Proceed" then
					hum.WalkSpeed = 0
					hum.JumpHeight = 0
					anims.M1:Play()
					anims.M1:GetMarkerReachedSignal("Hit"):Connect(function()
						if cd == false then
							cd = true
							print("no")
							local check2 = event:InvokeServer({1, "M1"})
							if check2 == true then
								hum.WalkSpeed = 16
								hum.JumpHeight = 7.2
								count = 2
							end
							task.wait(.2)
							cd = false
						end
					end)
				end
			elseif count == 2 then
				local check1 = event:InvokeServer({2, "Start"})
				if check1 == "Proceed" then
					hum.WalkSpeed = 0
					hum.JumpHeight = 0
					anims.M2:Play()
					anims.M2:GetMarkerReachedSignal("Hit"):Connect(function()
						if cd == false then
							cd = true
							print("no")
							local check2 = event:InvokeServer({2, "M2"})
							if check2 == true then
								hum.WalkSpeed = 16
								hum.JumpHeight = 7.2
								count = 3
							end
							task.wait(.2)
							cd = false
						end
					end)
				end
			elseif count == 3 then
				local check1 = event:InvokeServer({3, "Start"})
				if check1 == "Proceed" then
					hum.WalkSpeed = 0
					hum.JumpHeight = 0
					anims.M3:Play()
					anims.M3:GetMarkerReachedSignal("Hit"):Connect(function()
						if cd == false then
							cd = true
							print("no")
							local check2 = event:InvokeServer({3, "M3"})
							if check2 == true then
								hum.WalkSpeed = 16
								hum.JumpHeight = 7.2
								count = 4
							end
							task.wait(.2)
							cd = false
						end
					end)
				end
			elseif count == 4 then
				local check1 = event:InvokeServer({4, "Start"})
				if check1 == "Proceed" then
					hum.WalkSpeed = 0
					hum.JumpHeight = 0
					anims.M4:Play()
					anims.M4:GetMarkerReachedSignal("Hit"):Connect(function()
						if cd == false then
							cd = true
							print("no")
							local check2 = event:InvokeServer({4, "M4"})
							if check2 == true then
								hum.WalkSpeed = 16
								hum.JumpHeight = 7.2
								count = 1
							end
							task.wait(.2)
							cd = false
						end
					end)
				end
			end
		else
			count = 1
		end

help and feedback would be appriciated. :slightly_smiling_face:

i narrowed the problems down to here

if Tick - lastAttackTick < resetTime then
		else
			count = 1
		end

Ok, first of all, are you aware that RunService.Stepped:Wait() returns two numbers?


If you want the delta time, use this select(2,RS.Stepped:Wait())
If you really intend the first number, where did you set the lastAttackTick and resetTime

Second, InvokeServer might be causing the issue. InvokeServer yields/waits the code until the code in the server finishes. Probably the server never ends the code

1 Like

However, I don’t think you will be using delta time because of this

1 Like

i see. thank you for informing me!

im sorry for such a late reply but, is there any other method i can use to reset the count after a specific amount of time?