So I’m creating a combat system where every time you click, it’ll combo and play another animation if clicked in time.
The problem I’m facing is that I have a debounce in place that doesn’t work until ALL animations of the combo have been played, it just spams all attack animations at first, then works properly afterwards.
I’ve looked through the devforum for this specific situation, but I couldn’t find anything like this, hence why I’m making this post.
LocalScript in Character:
UIS.InputBegan:Connect(function(input)
if IsStunned.Value or attacking.Value then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if not attacking.Value and not blocking.Value then
attacking.Value = true
if Running.Value then
runAttack()
attacking.Value = false
return
end
attack()
attacking.Value = false
end
end
if input.KeyCode == Enum.KeyCode.F then
block()
end
end)
You seem to check if they are attacking or blocking but only deal with the running case inside the logic for attacking and blocking. So if they are running, and they attack, this function will enter the MouseButton1 part when they are running (because attack is set to false) then if they click again the function will re-enter because attacking is now false but running could still be true so it returns.
It was not my suggestion to remove it, it was my suggestion that logic around the order and nature that these events and logic trees are being created could be flawed with one piece of logic only being dealt with inside another piece of logic that is reliant on two parameters. Removing that code above will undoubtedly not work at all, you have to sit and think in your mind how these events could be fouling one another.
ah, i misunderstood a little, i just wanted to see if by removing that block of code it could lead somewhere. ill switch up the orders and events to see where everything fits
well, i did just figure out that the value that’s messing up everything is “attacking”, specifically whenever attacking’s Value is defined as false. The values definitely work, but its as if the function gets to “attacking = false” too quickly.
being more specific, when i do attack for the first time, attacking is false despite it being set to true when attacking, and only until all animations are used attacking will be correctly set to true during attacks
Interestingly, it didn’t have to do anything with how the values were handled, i loaded all the animations before calling the attack functions and it worked perfectly. I appreciate all the help given regardless.