Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does LookVector always go to the side, even tho its supposed to go front?

Asked by 5 years ago

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!

0
Are you sure that the part is pointing to the front of your vehicle? Norbunny 555 — 5y
0
Yes. It works, it goes straight, but it just goes to the side evn tho its going forward. ieatandisbaconhair 77 — 5y

Answer this question