AutoPilot, Help!

I’m working on an AutoPilot system for a car that uses A-Chassis Tune. I’m trying to figure out how I can make it where when the sensors on the car touches a specific part the car slightly turns. I already got the detection part of it down and all but the way I’m currently doing it is that the entire model rotates when you touch it instead of the car actually steering. Heres the code, it is inside of the sensor:

local model = game.Workspace.Car2

local function onPartTouched(otherPart)
	if otherPart.Name == "RoadMarking" then
		print("hola")
		local primaryPartCFrame = model:GetPrimaryPartCFrame()
		local newCFrame = primaryPartCFrame * CFrame.Angles(0, math.rad(-2), 0)
		model:SetPrimaryPartCFrame(newCFrame)
	end
end

part.Touched:Connect(onPartTouched)
1 Like

If you wanted to make the car steer away, you will have to make the individual wheels turn away; not the model. What you are doing is that you’re setting the entire model’s cframe to where you want it to go. You could possibly make the car angle away in the opposite direction with some math but I’d be careful as well, I’m unsure on how the actual system works.

TLDR: In short, what you’re trying to do is a bit more complex than what this script is doing as you will have to figure out how the actual system is turning the car, then replicate it within another script; or within it. Either way will have to do.

1 Like

Thanks for the reply. Although I understand that, and thats what I’m trying to get away from. I tested that way of doing it with the wheels by rotating the wheel before and then going into the game and going forward to see if the car goes to where the wheel is turned but all it does is break the wheel. I’m trying to see if a person on here knows what the A-Chassis Tune is, its what most vehicles use in roblox. Its a well known system.

1 Like