So what I've done is a script that checks when the player is jumping , and if he is then add more walkSpeed, but if he stops jumping and starts walking again set it back to the original WalkSpeed. Everything is working as intended just that when I reach the max WalkSpeed, stop, and jump again it instantly rises to the max instead of doing it slowly, as intended. Here is the code:
Humanoid = script.Parent.Humanoid
while true do
Humanoid.StateChanged:Connect(function(old , new)
if new == Enum.HumanoidStateType.Running then
Humanoid.WalkSpeed = 17
--Player is running^
elseif new == Enum.HumanoidStateType.Jumping then
Humanoid.WalkSpeed = Humanoid.WalkSpeed + 0.05
--Player has jumped^
end
if Humanoid.WalkSpeed >= 50 then
Humanoid.WalkSpeed = 50
end
end)
wait()
end

8 comments
The LocalScript is placed inside of StarterPlayer > StarterCharacterScripts
You have an event inside an infinite loop...
@blockmask well that was the way I knew to do it, do you have any idea what could I change ? I'm not too good at lua as of now.
@tonicos33 there is no need for the while loop
Remove the 'while loop' and add a 'for loop' in the "elseif new == Enum.HumanoidStateType.Jumping then". For e.g: 'for i = 1,10 do Humanoid.WalkSpeed = Humanoid.WalkSpeed + 0.05 end'
Also use a wait(0.05) or something inside the for loop
@StrategicPlayZ I'm not sure about how to use for loops. You see, I want the game to constantly check if the player jumped, and I don't see how can I do that with a for loop.
And another problem is that I want the game to add up to the WalkSpeed until it reaches 50. Right now it doesn't add more then 0.05