Why won't my cart go up?

Hey there, I’m making a simple cart ride game but for some reason the cart wont go up this darn ramp LOL. I dont know if it has to do with the power or what. Please help if you can!

CODE SNIPPET:

local cart_on = script.Parent.Parent.CartOn
game:GetService("RunService").Heartbeat:Connect(function()
	local speed = script.Parent.Parent.Speed.Value
	if cart_on.Value == true then
		local look = script.Parent.CFrame.lookVector * speed
		script.Parent.BodyVelocity.Velocity = Vector3.new(look.X, -15, look.Z)
	else
		script.Parent.BodyVelocity.Velocity = Vector3.new(0, -5, 0)
	end
end)
1 Like

Try this out. Sorry if it doesn’t work off the bat, my brain isn’t working.

script.Parent.BodyVelocity.Velocity = script.Parent.CFrame:vectorToObjectSpace(Vector3.new(0, -15, speed))

It errors with “DownVector is not a valid member of CFrame”?

I have just tried CFrame.UpVector*-15 but its the same result

Check my code again, I realized I took the wrong approach. I’m on my lunch break and on my phone, so if you still have the issue unsolved in a few hours I will be back to help.

It works but the same issue occurs. It just gets stuck. I messed around with speed and it seemed for it to go up I had to put the speed really high like over 100 but then you would just fly off LOL. Thanks for your help so far!

1 Like

It would help if you included a video of the cart attempting to go up so we could determine the issue more easily.

You could try adding some “booster pads” that automatically make the cart go up faster on ramps.

Can you print and share the XYZ velocity when it gets stuck? Can you decrease the gravity a little?

Here is a CLIP

Sorry for late response, I was sleeping. This is what it prints. Once it gets stuck the velocity just stays the same at 24.988180160522, -14.968077659607, 1.2440221309662. image

Here’s another CLIP @JarodOfOrbiter @crazyblocks234

What is the BodyVelocity’s MaxForce set to? You can try setting it higher. You can also try disabling its Y component (e.g. 100000, 0, 100000). If neither of these work the part is probably physically getting stuck somewhere.

1 Like

That was the issue LOL. Its max velocity was set to 20000, 2000, 20000. Now it goes up thanks! CLIP

By any chance you would know why this is happening? Depending on how I get on the cart just turns. CLIP

I fixed it by just turning everything on massless but now another problem is the cart falls off the tracks way to easy. PROBLEM. This Also happens when going on a ramp really slow.

You can keep massless on since it won’t be the reason the cart falls. You can try putting a BodyForce inside the main part and set its force to a negative number. I would just experiment the number until you get a good balance of stable and unstable.

The MaxForce of your BodyVelocity will always need to be larger than whatever number you set your BodyForce to or else it’s going to slow down the cart.

Do you have a base force I should try for it?

-workspace.Gravity*basePart:GetMass()

Would this be on the Y force.?

Yes, and only Y. If you put anything on X/Z it might contribute to making the cart fall out.