What do you want to achieve?:
I want detect if part (car) is on green line
is right from line return 1
is left from line return -1
is on line return 0

What is the issue?
It works when street have no rotation.

What solutions have you tried so far?
I try use CFrame.x

code snippet:

function isOnSite(part)
local m=0
if part.Name=="STREET" then
local getP=part.CFrame.X+(part.Size.X/4)
print(scanner.CFrame.X.." == "..getP)
if scanner.CFrame.X>getP then
return -1
else
return 1
end
end
return 0
end

If you want to know if it is on the green line or not, could you just use Part.Touched?

Note: if the green line will not exist in the game and you want the car to center, I would think your mathematical expression would work. Maybe it’s a coding error.

Putting all the math stuff aside. I recommend a rabbit approach. To where the car is trying to catch up with some invisible object on a track. Then you can simply use the math on that object to follow the path instead. Might be smoother than just trying to make the car go. Interesting nevertheless. That’s all the support I can provide tho, this is pretty much beyond me.

Or disregard this post if you’re already doing that haha.

local function Check(Part, Car)
local DotProduct = (Part.Position - Car.Position):Dot(Car.CFrame.RightVector)
local Side = DotProduct < 0 and -1 or DotProduct > 0 and 1 or 0
return Side
end

Well you’re using global coordinates x axis… so…
You’ll have to implement a way to account for part rotation and define what you mean/want.
You could for example compare the car position to the position of the road part ± rightVector and see which one (positive or negative) it is closest to.

You could use the dot product on the right vector of the line and the vector between the line and the car. Or you could use the CFrame:pointToObjectSpace(Vector3) method and check the sign of the x component.

Keep in mind this is assuming the line is CFramed such that the right face of the part is facing right.

Please ensure that you mark a solution if your question has been resolved, so that others who have the same problem and come across your thread know where to look first.