I’m trying to move a train made using mesh parts with Body Velocity.
I’m gradually increasing the speed with the script, but when the train approaches a curve, it always rolls over.
There is no change even if the density of the dolly is increased.
Why is this happening?
4 Likes
I suggest you check the script again. You may not have added the return commands.(I hope I could help you )
Body velocity is global, not local to the part it is inside of. It’s a bit like vector, rather than CFrame. I believe “BodyThrust” is relative to the part, so try using that instead.
while true do
wait()
if script.Parent.Throttle == 1 then
script.Parent.Value.Value = script.Parent.Value.Value + 1
wait(0.3)
end
if script.Parent.Throttle == -1 then
script.Parent.Value.Value = script.Parent.Value.Value - 1
wait(0.3)
end
if script.Parent.Value.Value == -1 then
script.Parent.Value.Value = 0
wait()
end
script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.LookVector*(script.Parent.Value.Value)
end
This is the script I’m using.
I’ve used VectorForce instead of BodyThrust, but I don’t like it because even if I use the brakes, it runs backwards past 0.