local MovementVelocity = Character:WaitForChild("HumanoidRootPart").Velocity * Vector3.new(1,0,1)
The code above demonstrates a simple solution to calculate a player’s movement velocity on a flat surface by ignoring the Y-axis component of the velocity. This works well for basic systems.
However, I’m encountering an issue where this code does not accurately account for movement on sloped surfaces (such as wedges). When the player is moving along a tilted surface, the Y-axis velocity changes due to the incline, even though the player isn’t jumping or falling. This results in incorrect values, as the Y component becomes part of the horizontal movement.
In summary, I want to calculate the player’s movement velocity without including the additional velocity caused by jumping or falling, but still account for movement on sloped surfaces.