Vehicle Seat .Throttle Won't Move Car, Stuck At 1

I’m trying to make a script that moves a car through “the .throttle” property of the driveseat. I’ve so far tried it on the roblox red sedan, their van, and a free model lambroghini car. I also tried doing this through the properties while in running, and it just went up to 1 throttle max.

Any way to fix this? Thanks.

1 is the max throttle a VehicleSeat can have. You should do this instead:

local maxSpeed = 30
local vehicleSeat = script.Parent --the vehicle seat

while wait() do
      motors.speeds = vehicleSeat.Throttle * maxSpeed -- replace "motors.speeds" with the speed properties of your motors
-- so, say the .Throttle is at 1. 1 x 30 = 30
end

Thanks for the reply. I can’t seem to find where the motor is. The closest thing I found is a script inside of the main driveseat that’s called, “Create Motors And Doors 2”. Do you know where the motor would be located? Thanks.

Here’s the contents of that “Create Motors And Doors 2” script:

--MADE BY NWSPACEK

WheelSize = 3--diameter of the wheel

--When you are editing the car, make sure that the Left, Right, and Base parts are in a 
--straight line, and in the orientation the models comes with, or they won't be where you expect
--them to be at all!

motorSpeed = 0.05 -- a typical number is 0.1 but lower is better if you get weird behavior


--don't touch below, very delicate
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)--we'll get a CFrame value out of a CFrameValue or a StringValue formatted like a CFrame
	if object:IsA("CFrameValue") then--if someone is using a CFrame value then we'll just pull the value directly
		return object.Value
	elseif object:IsA("StringValue") then--added functionality for this because I dislike interfacing with CFrame values
		local cframe = nil
		pcall(function()--using pcall because i'm lazy
			cframe = CFrame.new(object.Value:match("(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+),(.+)"))
			--if you print your CFrame and paste it into the string value, this will find that out and use it properly
		end)
		return cframe
	end
end

for _,h in pairs (car:GetChildren()) do
	if h:IsA("Motor6D") then--make sure we start with a blank slate
		h:Destroy()
	end
end

for _,i in pairs (car:GetChildren()) do
	if i:IsA("BasePart") and i.Name:find("DoorHinge") then-- found a door with regex!
		local DoorID = i.Name:match("DoorHinge(.*)")--haha regex is fun
		local MatchingDoor = car:FindFirstChild("Door"..DoorID)--can we use our regex powers to find a matching door?
		if MatchingDoor then-- yay we found one!
			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

I suggest watching these videos (part 1, part 2) to better understand how you could make a car system.

1 Like

Well I’m not looking to make one, but thanks that’ll be very helpful for understanding it better. I’m looking to get gud at scripting anyways - I’ve been scripting for 3 weeks and plan start learning full web development later this year and beyond. Thanks for the resources. I’ll check them out.

1 Like

How would I go about visualising the ray? I think I remember seeing a way to do that, I just can’t find clear instruction on it, though I’ll keep looking.

Do you mean the yellow round stick in the front of the vehicle seat? If so, select the vehicle seat, scroll down (in the properties tab) to “surface inputs”, and set “Front” to “Hinge”

Ohh sorry haha! Wrong post. I was talking about a ray in raycasting. It’s where you have detection in a direction you point it to for however long you set it to. Then when it detect’s something hitting the invisible ray, it will do whatever you tell it to. In this case I’m trying to make it move when it finds something in it’s way.

I still can’t seem to find where the motor is, with it’s speed property. Is there a name to them or somewhere I could find the motor? I’m not sure I want to create my own vehicle. Thanks.

1 Like