INFORMATION: I was working on a melee tool for a while now, everything was going smoothly until I wanted to make it where if the player jumps and presses q in a certain time they will do an overhead attack that will do stuff later on, but while scripting it, nothing prints, can I get some help?
PROBLEM: (What I presume) The script gets to a certain point and the script and freezes/stops and does not print anything.
SCRIPT:
-- change variable when player jumps character.Humanoid.Jumping:Connect(function() jumping = true end)
uis.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Q then if toolEquipped == false then return end; if kicking or guarding or usingSpeical == true then return end; if not punching then punching = true -- overhead if jumping == true then if tick()-timer < 0.15 then print("overhead") wait(0.5) punching = false end timer = tick() else if tick()-timer > 2 then punchAnimation = 0 end timer = tick() punchAnimation = punchAnimation + 1 local ActionAnimation = character.Humanoid:LoadAnimation(replicatedStorage.Animations["MeleePunch"..punchAnimation]) ActionAnimation:Play() actions.Punch:InvokeServer(punchAnimation) if punchAnimation >= 2 then punchAnimation = 0 end end end)
Any help would be greatly appreciated!
the reason is that you set punching to true but then only set it back to false if your combo triggered. The first time it likely did not because you were either not jumping or not pressing q twice within .15 seconds, which is rather stringent. From then on indeed the script locks and doesn't pass "if not punching then" on line 5 of the second script anymore
To solve move "punching = false" to the end of the mentioned if statement, so between line 31-32 (your example code is missing some 'end's here, prob from copy pasting).