So I had a car that worked perfectly fine, and one day they randomly started turning the opposite direction than originally. This is the part of the script that controls that motor turning, any help?
after some more testing, I found that this was the script that controls this, this first script is full and is local, the 2nd script is server and is only part of the original script
wait(1) SeatValue = script:WaitForChild("Seat") if SeatValue:IsA("ObjectValue") and SeatValue.Value and SeatValue.Value:IsA("VehicleSeat") then seat = SeatValue.Value car = seat.Parent if seat:FindFirstChild("RocketPropulsion") then seat.RocketPropulsion:Fire() end local RemoteControlled = car:FindFirstChild("ControlByRemote") while seat:FindFirstChild("SeatWeld") and RemoteControlled do wait() if not RemoteControlled:IsA("VehicleSeat") then break end RemoteControlled.Throttle = seat.Throttle if car:FindFirstChild("LeftMotor") then car.LeftMotor.DesiredAngle = seat.Steer*math.rad(30-RemoteControlled.Velocity.magnitude/4) end if car:FindFirstChild("RightMotor") then car.RightMotor.DesiredAngle = seat.Steer*math.rad(30-RemoteControlled.Velocity.magnitude/4) end if car:FindFirstChild("Configuration") then if seat.Throttle == 1 and car.Configuration:FindFirstChild("Forwards Speed") then RemoteControlled.MaxSpeed = car.Configuration["Forwards Speed"].Value elseif seat.Throttle == 0 then RemoteControlled.MaxSpeed = 0 elseif seat.Throttle == -1 and car.Configuration:FindFirstChild("Reverse Speed") then RemoteControlled.MaxSpeed = car.Configuration["Reverse Speed"].Value end end end if seat:FindFirstChild("RocketPropulsion") then seat.RocketPropulsion:Abort() end end
SECOND SCRIPT (SERVER)
while true do for i = 1, 60 do--60/30 == 2, 2 seconds between deciding if it's upside down wait()-- we want the steering and sfx to update as many times a second as we can if workspace.FilteringEnabled then if car:FindFirstChild("LeftMotor") then car.LeftMotor.DesiredAngle = seat.Steer*math.rad(60-RemoteControlled.Velocity.magnitude/4) end if car:FindFirstChild("RightMotor") then car.RightMotor.DesiredAngle = seat.Steer*math.rad(60-RemoteControlled.Velocity.magnitude/4) end end
Try using this:
if Base then if Left then leftMotor = Instance.new("Motor6D", car) rightMotor.Name = "LeftMotor" rightMotor.Part0 = Left rightMotor.Part1 = Base rightMotor.C0 = CFrame.new(-WheelSize/2-Left.Size.x/2,0,0)*CFrame.Angles(math.pi/2,0,-math.pi/2) rightMotor.C1 = CFrame.new(Base.Size.x/2+Left.Size.x+WheelSize/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2) rightMotor.MaxVelocity = motorSpeed end if Right then = Instance.new("Motor6D", car) leftMotor.Name = "RightMotor" leftMotor.Part0 = Right leftMotor.Part1 = Base leftMotor.C0 = CFrame.new(-WheelSize/2-Right.Size.x/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2) leftMotor.C1 = CFrame.new(-Base.Size.x/2-Right.Size.x-WheelSize/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2) leftMotor.MaxVelocity = motorSpeed end end
Hello. Try using elseif Right then
.
if Base then if Left then leftMotor = Instance.new("Motor6D", car) leftMotor.Name = "LeftMotor" leftMotor.Part0 = Left leftMotor.Part1 = Base leftMotor.C0 = CFrame.new(-WheelSize/2-Left.Size.x/2,0,0)*CFrame.Angles(math.pi/2,0,-math.pi/2) leftMotor.C1 = CFrame.new(Base.Size.x/2+Left.Size.x+WheelSize/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2) leftMotor.MaxVelocity = motorSpeed end elseif Right then rightMotor = Instance.new("Motor6D", car) rightMotor.Name = "RightMotor" rightMotor.Part0 = Right rightMotor.Part1 = Base rightMotor.C0 = CFrame.new(-WheelSize/2-Right.Size.x/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2) rightMotor.C1 = CFrame.new(-Base.Size.x/2-Right.Size.x-WheelSize/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2) rightMotor.MaxVelocity = motorSpeed end end
So basically, after a little research, I found out that roblox, FLIPPED, the motor6D and a bunch of things relating to that. So I just flipped the code a little bit. And it works.