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

Why is BodyVelocity and BodyAngularVelocity laggy?

Asked by 5 years ago
Edited 5 years ago

i made a car that is controlled by bodymovers. but whenever i drive or turn, it takes about 1 second to drive, or to turn. In studio it works completely fine tho. why?

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
        car.Wheels.RL.Wheel.WeldMeToTire.MaxVelocity = stats.TopSpeed.Value * s.Throttle
        car.Wheels.RL.Wheel.WeldMeToTire.DesiredAngle = 5435435435434343242324365466554424354345 * s.Throttle
        car.Wheels.RR.Wheel.WeldMeToTire.MaxVelocity = stats.TopSpeed.Value * s.Throttle
        car.Wheels.RR.Wheel.WeldMeToTire.DesiredAngle = 5435435435434343242324365466554424354345 * s.Throttle
    end
        if pro == "Steer" then
        car.Base.BodyAngularVelocity.AngularVelocity = Vector3.new(0,-stats.TurnSpeed.Value,0) * s.Steer
        car.Wheels.FL.Axel.WeldMeToTire.MaxVelocity = 0.45
        car.Wheels.FL.Axel.WeldMeToTire.DesiredAngle = -0.7 * s.Steer
        car.Wheels.FR.Axel.WeldMeToTire.MaxVelocity = 0.45
        car.Wheels.FR.Axel.WeldMeToTire.DesiredAngle = -0.7 * 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
That's called Latency/Ping. You can get around this by setting network ownership of the car to the player that's driving it. This will however open it up to certain exploits though. RubenKan 3615 — 5y
0
also no need to put "hell" in your title... User#19524 175 — 5y

Answer this question