Hi, I’m making a cart ride in my game and cant figure out why my cart always falls of the rails. I made turns as well and it doesn’t fully turn.
PROBLEM
CODE:
local cart = script.Parent.Cart
game:GetService("RunService").Heartbeat:Connect(function()
local cart_on = script.Parent.CartOn.Value
local speed = script.Parent.Speed.Value
if cart_on then
local look = cart.CFrame.lookVector * speed
cart.BodyVelocity.Velocity = cart.CFrame:VectorToObjectSpace(Vector3.new(0, -15, -speed))
else
cart.BodyVelocity.Velocity = Vector3.new(0, -5, 0)
end
--print(cart.BodyVelocity.Velocity)
end)
NOTE Inside the cart part there is a BodyForce, BodyGyro, and BodyVelocity