Renderstep running a bit to fast lol

Ok so this is probably a dumb title, but basically, I have an input buffer system for my fighting game and I have it connected to a render step and I know that this means it’s running like every frame which is kind of what I want because it’s checking for inputs however it’s running so fast that it sometimes runs the code multiple times so basically if I hit G to do a punch it does the punch but sometimes it will do the punch again even though I only hit G once.

At first I thought to just add a debounce however now I have the issue of your inputs don’t feel instant and it just feels weird so I wanted to know if there was anything else I could do?

local function TryBufferedInput()
    local Length = Queue:length()

    for i = 1,Length do
        local Object = Queue:peek(i)
        local OldTime = Object["TIME"]

		if ((os.time() - OldTime) > ActionExpire) then
			--warn("[CLIENT]: Expired")
			if Debounce then
				Debounce = false
				Debounce = true

1 Like

Just going to point out that os.time() is accurate to the second. I would recommend good old tick() rather than os.time().

Edit: (forgot to say you might want to do this otherwise it will wait up until the second changes which can be from a time period of 0->1 seconds! not too good for your code there)

Your code otherwise looks fine to me :smiley: . I can’t give you an answer though since I’m not familiar with Queue (time to learn it rn) and not sure where other identifiers are coming from, making a guess here…