Hiya! Another Question for the Development Forums!
I want to find Players Speed, either Walkspeed or Studs Per Second (SPS), or something!
I have tried walkspeed, the Property in humanoid, but it is only the maximum walk speed, rather than what the player is walking at that moment.
I have seen some stuff (Aircraft Kits, stuff like that) where they have managed to get “Player Speed”, or Model Speed or something, and this is what I want. I am wondering if it is SPS, or something else, but it’d be good to know if you can help me!
Hello! put this code into a local script, you can just put it under starter player scripts. When you test the game, it will print the current speed of the player in the output!
wait(15)
local character = game.Players.LocalPlayer.Character
local currentSpeed = 0
local pos = character.HumanoidRootPart.Position
while true do
pos = character.HumanoidRootPart.Position
wait(1)
currentSpeed = (pos-character.HumanoidRootPart.Position).magnitude
print(currentSpeed)
end
Thank you! Works perfectly! This is exactly what I need; I will just connect it up to a Value in ReplicatedFirst, then use that to transmit to a GUI! ~ AridOats
Couldn’t you also find the .Velocity of the HumanoidRootPart? It would be a bit easier and wouldn’t take up as many lines. Wouldn’t checking the position of the Hrp also count the Y values? (when the player jumps or is falling, the current speed would skyrocket). Here is my example:
local Walkspeed = (Hrp.Velocity * Vector3.new(1,0,1)).Magnitude