What would I put in a script to make when the character moves it picks up speed? Would I use a loop to add to the players speed by increments?
How would I make the Character get faster as it moves?
2 answers
local hum = script.Parent:WaitForChild("Humanoid")
local torso = nil
--check rig type
if hum.RigType == "R6" then
torso = script.Parent.Torso
else
torso = script.Parent.UpperTorso
end
while wait() do --put a number in the () if you want to slow down speed incerasing
if torso.Velocity.Magnitude > 1 then
hum.WalkSpeed = hum.WalkSpeed + 0.1 --this is how the walkspeed incerases
else
hum.WalkSpeed = 16 --default walkspeed
end
end
Put this into StarterCharacterScripts. Works with R6 and R15.
You should indeed use loops and use increments, It isn't done completely in a loop because it would add to the speed when the player isn't moving, script is below, the explenation is too, if you need some more explanation, feel free to ask (btw mark this as answered please xD)
Script needs to be in workspace
Increment = 1 -- It will become this much faster every time
DelayT = 0.1 -- It will wait this time before it starts the loop again
defSpeed = 5 -- Starterspeed, this number will change trough the loop
maxSpeed = 100 -- If you don't want this set it to 99999999999999999999999 or something like that xD
Speed = defSpeed
plrWalking = false
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
player.Character.Humanoid.Running:connect(function(speed)
if speed > 0 then -- player isn't standing still
plrWalking = true
else
plrWalking = false
end
end)
end)
end)
while wait(DelayT) do
for index, player in pairs(game.Players:GetPlayers()) do
char = player.Character or player.CharacterAdded:wait()
hum = char:WaitForChild("Humanoid")
if hum and plrWalking and Speed < maxSpeed then -- if humanoid and player is walking
print("plr is running")
Speed = Speed + Increment
hum.WalkSpeed = Speed -- increasing speed
elseif not plrWalking then
Speed = defSpeed
hum.WalkSpeed = defSpeed -- reset speed when stopped
end
end
end
7 comments
wow
lol
i need 25 reputation to upvote... what? how do i get reputation since other users havent got reputation and cant upvote... wait... is reputation based on upvoting?
also wouldn't "inf" do the the trick in maxSpeed instead of 99999...?
Thank you for also answering!
If you manually put in inf it doesn't work, so I don't think so xD
can you make me one that works with the newest version of roblox? i tried this and it did not work.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Curious over here: Why did you set torso to nil? Is this required?
Just in case. It is changed later based on the rig type.
Thank You!