So my car was working fine until yesterday when the turning turned opposite. heres my script.
WheelSize = 2.6
motorSpeed = 0.035
car = script.Parent.Parent
Base = car:FindFirstChild("Base")
Left = car:FindFirstChild("Left")
Right = car:FindFirstChild("Right")
function MakeDoor(hinge,door,hingeOffset,doorOffset)
local doorMotor = Instance.new("Motor",car)
doorMotor.Name = hinge.Name.."Motor"
doorMotor.Part0 = door
doorMotor.Part1 = hinge
doorMotor.C0 = doorOffset
doorMotor.C1 = hingeOffset
doorMotor.MaxVelocity = 0.05
door.CanCollide = true
local doorDebounce = false
door.Touched:connect(function(it)
if not doorDebounce and it.Parent and it.Name == "HumanoidRootPart" and game:GetService("Players"):GetPlayerFromCharacter(it.Parent) then
doorDebounce = true
door.CanCollide = false
doorMotor.DesiredAngle = math.pi/3
wait(1.5)
doorMotor.DesiredAngle = 0
wait(0.5)
door.CanCollide = true
doorDebounce = false
end
end)
end
function MakeWeldDoor(hinge,door)
local doorMotor = Instance.new("Motor6D",car)
doorMotor.Name = hinge.Name.."Motor"
doorMotor.Part0 = door
doorMotor.Part1 = hinge
doorMotor.C1 = hinge.CFrame:inverse()*door.CFrame
door.CanCollide = false
end
function GetCFrame(object)
if object:IsA("CFrameValue") then
return object.Value
elseif object:IsA("StringValue") then
local cframe = nil
pcall(function()
cframe = CFrame.new(object.Value:match("(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+)"))
end)
return cframe
end
end
for _,h in pairs (car:GetChildren()) do
if h:IsA("Motor6D") then
h:Destroy()
end
end
for _,i in pairs (car:GetChildren()) do
if i:IsA("BasePart") and i.Name:find("DoorHinge") then
local DoorID = i.Name:match("DoorHinge(.*)")
local MatchingDoor = car:FindFirstChild("Door"..DoorID)
if MatchingDoor then
local DoorCFrameValue = MatchingDoor:FindFirstChild("DoorCFrame")
local HingeCFrameValue = MatchingDoor:FindFirstChild("HingeCFrame")
if DoorCFrameValue and HingeCFrameValue then
local doorCFrame = GetCFrame(DoorCFrameValue)
local hingeCFrame = GetCFrame(HingeCFrameValue)
if doorCFrame and hingeCFrame then
MakeDoor(i,MatchingDoor,hingeCFrame,doorCFrame)
else
MakeWeldDoor(i,MatchingDoor)
end
else
MakeWeldDoor(i,MatchingDoor)
end
end
end
end
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
if 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 this is the code I believe is actually doing this, any help?
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
For the record and future users:
This is NWSpacek’s script. It’s pretty old, and Motor6Ds got some changed a couple of months ago, which inverted most if not all Motor6D.
What you want to do is on the lines where you set the DesiredAngle, you just add a *-1 at the end. Multiplicating by -1 will invert the number, and the wheel will turn the proper way. Alternatively, you can put a minus before seat.Steer (so it becomes -seat.Steer), which does the same thing and looks a bit better.
I don’t think so. The RP community (which is probably the only community that still uses his scripts) has unfortunately largely not moved on (with a few exceptions, e.g. Mayflower).
I will be working on releasing something that is just his scripts but refreshed. No ETA yet.
If you just want to get your scripts working, you can use my solution in my first post.
I tried so far, it seems to work, but for some reason sometimes it glitches if you turn. it likes flashes quick in both directions making it go straight (sometimes not all the time, but still pretty annoying). Anyways i would go forward to your refresheds scripts.