WalkSpeed is instantly increasing?
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:
01 | Humanoid = script.Parent.Humanoid |
03 | Humanoid.StateChanged:Connect( function (old , new) |
04 | if new = = Enum.HumanoidStateType.Running then |
05 | Humanoid.WalkSpeed = 17 |
07 | elseif new = = Enum.HumanoidStateType.Jumping then |
08 | Humanoid.WalkSpeed = Humanoid.WalkSpeed + 0.05 |
11 | if Humanoid.WalkSpeed > = 50 then |
12 | Humanoid.WalkSpeed = 50 |