How would I make the wheels know if they are in front of the center block, and if they are to the right or left? I’ve got a system working, but it only works for the one way that it is facing right now.
code for that part:
local yes = workspace.WheelIdentifier.Position.X - script.Parent.PrimaryPart.Position.X
local no = workspace.WheelIdentifier.Position.Z - script.Parent.PrimaryPart.Position.Z
local maybe
if no <0 then
maybe = true
end
if no >0 then
maybe = false
end
if yes <0 and maybe == false then
TURN_ANGLE = 20
end
if yes >0 and maybe == false then
TURN_ANGLE = -20
end
if yes <0 and maybe == true then
TURN_ANGLE = -20
end
For a similar problem involving speed, I just put an IntValue inside of each motor with a value of either 1 or -1. The value corresponds to which side of the vehicle the motor is on, then I multiply the speed by that value.
A solution like that could probably be extended to your use-case too.