Im trying to make it so that the player gains momentum and starts to run.
But whenever I stop running, my walkspeed is still 24.
How do I fix this?
while task.wait() do
local result = isKeyDown()
print(result)
print(humanoid.WalkSpeed)
if humanoid then
if humanoid.WalkSpeed == 16 then
if result then
for i = 1, 10 do
if humanoid.WalkSpeed == 24 then
break
end
task.wait(0.004)
humanoid.WalkSpeed += 0.8
humanoid.WalkSpeed = math.round(humanoid.WalkSpeed)
end
end
if not result then
for i = 1, 10 do
if humanoid.WalkSpeed == 16 then
break
end
task.wait(0.004)
humanoid.WalkSpeed -= 2
end
end
end
end
end