My script is supposed to have two functions (driving and turning). It is supposed to monitor for the values changing in the vehicle seat. I fear that's where my problems stem from. I have set all the turn hinges up as servos and the drive hinges as motors, (pls ignore my inconsistencies) all the names are all 100% what they should be.
--Tuning--
--- -1 left/backwards
hp = 100
--max_gear = 4
turn_speed = 2
turn_angle = 45
--1 slow 5 fast
--------------------------------------------------------------
local rf = script.Parent.Parent.rfl.steeringllower
local lf = script.Parent.Parent.lfl.steeringllower
local rr = script.Parent.Parent.RR.HingeConstraint
local lr = script.Parent.Parent.RL.HingeConstraint
local rfu = script.Parent.Parent.RFU.steerlupper
local lfu = script.Parent.Parent.lfu.steerlupper
local turn = script.Parent.Steer
local drive = script.Parent.Throttle
local function turn(value)
rf.TargetAngle = turn_angle * turn
rf.AngularSpeed = turn_speed * 10
lf.TargetAngle = turn_angle * turn
lf.AngularSpeed = turn_angle * 10
rfu.TargetAngle = turn_angle * turn
rfu.AngularSpeed = turn_speed * 10
lfu.TargetAngle = turn_angle * turn
lfu.AngularSpeed = turn_angle * 10
end
local function drive(value)
rr.MotorMaxTorque = hp * 100
lr.MotorMaxTorque = hp * 100
rr.AngularVelocity = drive * hp * 100
lr.AngularVelocity = drive * hp * -100
end
script.Parent.Steer.Changed:Connect(turn)
script.Parent.Throttle.Changed:Connect(drive)
i am also receiving this error everytime that i run it
Workspace.Model.VehicleSeat.Script:45: attempt to index number with 'Changed'
