I'm using a tutorial to make the original warfare's helicopter a truck type thing. Been using a suspension tutorial that uses a custom seat. The model itself is https://www.roblox.com/library/1547021507/Custom-Seat I had to add a NumberValue 'Throttle' because it didnt exist in the model to begin with. Can someone help me with this? The error is this: 14:26:34.468 - Workspace.VehicleSeat.Script:34: attempt to perform arithmetic on local 'throttli' (a userdata value) and the code is this:

-- get the specifications
local speed 		= script.speed.Value
local accleration 	= script.acceleration.Value
local steeringspeed = script.steeringSpeed.Value
local steeringangle = script.steeringAngle.Value

-- set up the shortcuts
local vehicle	= script.Parent.Parent
local seat 		= script.Parent
local throttli = script.Throttle

-- find the tires
local A			= vehicle.A		-- front left
local AA		= vehicle.AA	-- front right
local B			= vehicle.B		-- back left
local BB		= vehicle.BB	-- back right

-- find the steering mechanism
local steerA	= vehicle.SteeringA.Servo
local steerB	= vehicle.SteeringB.Servo


-- set up wheels' motor accerlation
A.Motor.MotorMaxTorque 		= accleration
AA.Motor.MotorMaxTorque 	= accleration
B.Motor.MotorMaxTorque 		= accleration
BB.Motor.MotorMaxTorque 	= accleration

while true do

	-- power the wheels
	velocity = throttli * speed -- use the seat's throttle to determine the wheels' action (backward? forward? nothing?)
	A.Motor.AngularVelocity 	= velocity
	AA.Motor.AngularVelocity 	= velocity
	B.Motor.AngularVelocity 	= -velocity
	BB.Motor.AngularVelocity	= -velocity

	wait()

	-- steering
	steering = throttli * speed
	steerA.AngularSpeed = steeringspeed
		steerA.ServoMaxTorque = 100000000
		steerA.TargetAngle = steeringangle*seat.Steer
	steerB.AngularSpeed = steeringspeed
		steerB.ServoMaxTorque = 100000000
		steerB.TargetAngle = steeringangle*seat.Steer
end

2 comments

0

Because your throttli variable points to the script.Throttle object itself and not the value property. Idk what it is but if it's a ValueBase , throttli.Value

0

That fixed that part but now its giving me and error for seat.Steer . that wasnt under the seat so im really not sure what to put there but thats progress