I have a state system and essentially when the player is attacking he can’t jump the issue is there is a small timeframe where the player is in idle state between each attack and he can jump there
My goal is to essentially stop jumping for the player during the attacks
you could set the jumppower to 0 during that time period
You can use Humanoid:SetStateEnabled
to disable the “Jump” state.
So for example you would disable jumping like this (this would also hide the jump button on mobile.)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
And to re-enable it just do:
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
a really easy way to do it is Humanoid.JumpPower = 0
My state system already does that the issue there is a small timeframe between each attack
I tried this too it still doesn’t work
Can you give a video of the jumping-between-attack?
Make sure you’re calling Humanoid:SetStateEnabled()
from the client who is no longer allowed to jump (e.g. through a LocalScript
that is being run by the player that is attacking).
If you try to set it from the server side, it won’t work as intended.
If you already tested it under those conditions, then we may need more details regarding its implementation in your state system to understand what other factors might be preventing it from enabling / disabling the Jumping
state.
Add a value into the player when the attack starts and use debris to keep it in there for about 1 second longer than the duration of the attack, then make a local script inside the player’s character that will set the humanoid’s jump power to zero if there is said value in the player. here is an example:
local value = Instance.new("BoolValue",player.Character)
value.Name = "CantJump"
game.Debris:AddItem(value,attackduration + 1)
local script:
game["Run Service"].RenderStepped:Connect(function())
if character:FindFirstChild("CantJump") then
character.Humanoid.JumpPower = 0
else
character.Humanoid.JumpPower = 50
end
end)
Yes, I should have mentioned that, I forgot this doesn’t work on the server. I don’t use humanoids that much anymore
Used that solution + when you do the event i added so it will cancel the old delay to turn jumping back on