if uis:IsKeyDown(Enum.KeyCode.A) then
local NewVelocity
if FloorMaterial == "Ramp" then -- if the sphere is on a ramp, make the speed 3
NewVelocity = cam.CFrame.RightVector * -3
else -- if the sphere is not on a ramp, make the speed 18
NewVelocity = cam.CFrame.RightVector * -18
end
Sphere.Velocity = NewVelocity
print(Sphere.Velocity.Magnitude) -- prints total speed of the sphere
end
I’m making a system where you roll a ball around with W, A, S and D. I found a post which says you can find the total speed of an object by doing (Object.Velocity.Magnitude), which works just fine.
What I want is to find the speed that the sphere is moving to its left. I’ve tried using some stuff relating to RightVector and Velocity stuff, but it’s printing relative to the global position of the sphere, instead of the local position. If you don’t know what that means, look at the arrows in these 2 pictures: