Hello! Im currently working on the Advanced Run script, and there is acceleration system. You run faster as you gain more acceleration, you can currently do that by 2 ways:
And first way seems to work alright with this part of script:
if humanoid.MoveDirection.Magnitude > 0 and not braking then -- if humanoid moves and not braking
if humanoid:GetState() == Enum.HumanoidStateType.Running then
accelerationPercent.Value = math.clamp(accelerationPercent.Value+1, 0, 100)
end
end
Although, when i tried to make the same for jump with checking humanoid’s state, for some reason it won’t add acceleration after jump:
player.CharacterAdded:Connect(function(character)
local hrp:Part = character:FindFirstChild("HumanoidRootPart")
local humanoid:Humanoid = character:WaitForChild("Humanoid")
--onJumpRequestRemote.OnServerEvent:Connect(function(plr)
--if plr ~= player then return nil end
humanoid:GetPropertyChangedSignal("Jump"):Connect(function() print(1)
local humState = humanoid:GetState()
if humState ~= Enum.HumanoidStateType.Freefall and humanoid.MoveDirection.Magnitude > 0 and not braking then
if not jumpAccelerationCooldown then
jumpAccelerationCooldown = true
accelerationPercent.Value = math.clamp(accelerationPercent.Value+3, 0, 100)
task.wait(0.2)
jumpAccelerationCooldown = false
end
else
print(humState)
end
end)
end)
It works like more than 50% of time, but i hope to find more accurate way so i will appreciate any help!
1 post - 1 participant