i made a car for a game that uses lookvector, but whenever im driving, the car goes to the side, and after it reached its amximum speed it stopped. Why?

script:

local s = script.Parent
local car = s.Parent
local stats = car.Base.Stats

local function changed(pro)
	if pro == "Throttle" then
		car.Base.BodyVelocity.MaxForce = Vector3.new(stats.Acceleration.Value, 0,stats.Acceleration.Value) * 4100
	end
		if pro == "Steer" then
		car.Base.BodyAngularVelocity.AngularVelocity = Vector3.new(0,-stats.TurnSpeed.Value,0) * s.Steer
		end
end
s.Changed:Connect(changed)

while true do
	car.Base.BodyVelocity.MaxForce = Vector3.new(stats.Acceleration.Value, 0,stats.Acceleration.Value) * 4100
	ok = s.CFrame.LookVector * stats.TopSpeed.Value
	car.Base.BodyVelocity.Velocity = Vector3.new(ok.x,0,ok.z) * s.Throttle
	wait()
end

thanks!

2 comments

0

Are you sure that the part is pointing to the front of your vehicle?

0

Yes. It works, it goes straight, but it just goes to the side evn tho its going forward.