local a=70 return function(d)local T=d:WaitForChild("\082\117\110\110\105\110\103\083\111\117\110\100")local j,D=(d:WaitForChild("\066\097\099\107\087\104\101\101\108")):WaitForChild("\077\111\116\111\114"),(d:WaitForChild("\070\114\111\110\116\087\104\101\101\108")):WaitForChild("\077\111\116\111\114")local p=(d:WaitForChild("\083\109\111\107\101\080\097\114\116")):WaitForChild("\069\120\104\097\117\115\116\083\109\111\107\101")return function()local X=(Vector3.new(d.Velocity.X,0,d.Velocity.Z)).magnitude local G=999999999*(-X/math.abs(X))local B=X/250 T.Pitch=1+math.abs(X/a)p.Opacity=(math.min(math.abs(X),10)/10)*.5 j.DesiredAngle=G j.MaxVelocity=B D.DesiredAngle=G D.MaxVelocity=B end end
--[[
TheNexusAvenger

Sets up animated the motorcycle.
Done on the client for latency and server for replication.
--]]

local MOTORCYCLE_MAX_SPEED = 70



return function(Motorcycle)
    --Get the components.
    local RunningSound = Motorcycle:WaitForChild("RunningSound")
    local BackWheelMotor,FrontWheelMotor = Motorcycle:WaitForChild("BackWheel"):WaitForChild("Motor"),Motorcycle:WaitForChild("FrontWheel"):WaitForChild("Motor")
    local ExhaustSmoke = Motorcycle:WaitForChild("SmokePart"):WaitForChild("ExhaustSmoke")

    --Return the update callback.
    return function()
        local Speed = Vector3.new(Motorcycle.Velocity.X,0,Motorcycle.Velocity.Z).magnitude
        local MotorDesiredAngle = 999999999 * (-Speed/math.abs(Speed))
        local MotorMaxVelocity = Speed/250
        RunningSound.Pitch = 1 + (math.abs(Speed / MOTORCYCLE_MAX_SPEED))
        ExhaustSmoke.Opacity = (math.min(math.abs(Speed),10)/10) * 0.5
        BackWheelMotor.DesiredAngle = MotorDesiredAngle
        BackWheelMotor.MaxVelocity = MotorMaxVelocity
        FrontWheelMotor.DesiredAngle = MotorDesiredAngle
        FrontWheelMotor.MaxVelocity = MotorMaxVelocity
    end
end