Preventing players from pushing moving vehicles using BodyVelocity

Hello, i’m working on my game and currently working on driving system (using scooter because i don’t have tram model ready).
Everything works fine however players are able to push the vehicles:

Thanks!

Can we see your script so we can fix it? I would recommend using a bodygyro.

1 Like

Thanks for answer,

  1. I tried BodyGyro but it doesn’t help much:
  2. The script is not important for this since it only changes the BodyVelocity:image
1 Like

Try changing the bodygyro settings and it should work.

Can’t you just anchor it? 30char

2 Likes

Body movers don’t work with anchored parts.

1 Like

If i anchor it BodyVelocity won’t work.

BodyGyro, still players would be able to slow it down by standing in front of it. (Also it works only on Y axis)

Oh, so even if you anchor it, it still won’t work?

1 Like

Do you want the player to be able to turn left and right and be able to drive the scooter?

I think this post can help. Or maybe I’m wrong. I’m new to this kind of stuff. :sweat_smile:

Nope, as i said it’s only for tram driving system. However i need it to go up hills and turn in rails.

Try adding a while loop and setting the orientation to the orientation that you want and make sure to have an if statement checking if the tram is going up a hill.

I don’t think this is a good solution just for performance issues.

Something like this:

local goingUpHill = false

while true do
	wait()
	if not goingUpHill then
		script.Parent.Orientation = Vector3.new(0,0,0)
	end
end

Will there be a lot of trams in the game?

Please use Heartbeat:Wait(), wait() is bad.

What about this?

local goingUpHill = false

script.Parent:GetPropertyChangedSignal('Orientation'):Connect(function()
	if not goingUpHill then
		script.Parent.Orientation = Vector3.new(0,0,0)
	end
end)

Up to 24 players + in singleplayer there will be simple AI trains. (Almost finished scripting them, body velocity is last thing)

Still players are able to slow it down by standing in front of it and glitch it out of the tracks (even with this script)

Why not just crank up the max power so it is really hard to slow down?