I'm trying to make scripted car but I have trouble scripting Vehicle Turning. For example this is how I handle Turning Right
local UIS = game:GetService("UserInputService") local part = script.Parent --This are Three things I use For moving and Turning local thruster = part.BodyThrust local gyro = part.BodyGyro local rotate = part.BodyAngularVelocity ------- local on_move = part.OnMove local R = 60 game:GetService("RunService").Stepped:Connect(function() --Resistance and Deaccelaration part.Velocity = part.Velocity - part.Velocity/R local function onKeyPress(inputObject, gameProcessedEvent) --Forward if inputObject.KeyCode == Enum.KeyCode.T then on_move.Value = true direction = part.CFrame.LookVector gyro.CFrame = CFrame.Angles(direction.X/2,direction.Y/2,direction.Z/2) end --Backward if inputObject.KeyCode == Enum.keyCode.G then on_move.Value = true direction = part.CFrame.LookVector gyro.CFrame = CFrame.Angles(-(direction.X)/2,-(direction.Y)/2,-(direction.Z)/2) end --Turning Right if (inputObject.KeyCode == Enum.KeyCode.T and UIS:IsKeyDown(Enum.KeyCode.H)) or (inputObject.KeyCode == Enum.KeyCode.H and UIS:IsKeyDown(Enum.KeyCode.T)) then on_move.Value = true direction = part.CFrame.LookVector rotate.AngularVelocity = Vector3.new(0,-2,0) gyro.CFrame = CFrame.Angles(direction.X/2,direction.Y/2,direction.Z/2) end --Left if i(inputObject.KeyCode == Enum.KeyCode.T and UIS:IsKeyDown(Enum.KeyCode.F)) or (inputObject.KeyCode == Enum.KeyCode.F and UIS:IsKeyDown(Enum.KeyCode.T)) then on_move.Value = true direction = part.CFrame.LookVector rotate.AngularVelocity = Vector3.new(0,2,0) gyro.CFrame = CFrame.Angles(direction.X/2,direction.Y/2,direction.Z/2) end -- end -------Stop the Car local function onKeyLetgo(inputObject, gameProcessedEvent) gyro.CFrame = CFrame.Angles(0,0,0) rotate.AngularVelocity = Vector3.new(0,0,0) end UIS.InputBegan:connect(onKeyPress) UIS.InputEnded:connect(onKeyLetgo) end)
But it seems that Variable "Direction", Which is lookVector, isn't updated when BodyAngularVelocity Rotates The part. It updates when you Re-press keys.