How Would I Script A Tank So It Would Move?

I made a tank and i want to make it move, how would i do that? Or what script would i use and where would i put it? should i group it? The Script For This and how to use it would be greatly appreciated!

You could use something like the inspire chassis but make the wheels transparent, here’s a video on how to connect a body to the chassis keep in mind you might have to play around to get it just right.

Here’s a video if you want the treads to move.

2 Likes

Btw My Tank looks like this:

Just give it transparent wheels my guy. Use a pretty basic script where it pulls vehicle seat informational inputs. psuedocode below

if throttle == 1 and steerleft == 0 and steerright == 0 then
wheels.AngularVelocity = 1 --vehicle moves forward
elseif throttle == 1 and leftsteer == 1 and rightsteer == 0 then
leftwheels.AngularVelocity = .5
rightwheels.Angularvelocity = 1 --moves forward while turning left
elseif throttle == 1 and rightsteer == 1 and leftsteer == 0 then
rightwheels.AngularVelocity = .5
leftwheels.AngularVelocity = 1 --moves forward while turning right
elseif throttle ==0 then --vehicle isnt moving forward
if leftsteer == 1 then
rightwheels.AngularVelocity = 1 --turns left
leftwheels.AngularVelocity = -1
elseif rightsteer == 1 then
leftwheels.AngularVelocity = 1
rightwheels.AngularVelocity = -1
end
else
wheels.AngularVelocity = 0
end

something like that. there are probably better ways to do it, but that is pretty much the simplest you can go code-wise

The inspare chassis would work but as I said you’d have to alter it a little like height and stuff.

This category is not for asking for free code. You can reference the many resources available on the catalog or attempt to do this yourself first, then post if you are having any trouble with your implementation of the system.

1 Like