Issue with scripting my first car (attempt to perform arithmetic (unm) on Instance)

I tried to script my very first car today after building it and i got this error : Workspace.Car.DriverSeat.VehicleSeat.Script:14: attempt to perform arithmetic (unm) on Instance

The script:

local leftwheelF = script.Parent.Parent.Parent.LeftWheelF
local leftwheelB = script.Parent.Parent.Parent.LeftWheelB
local rightwheelF = script.Parent.Parent.Parent.RightWheelF
local rightwheelB = script.Parent.Parent.Parent.RightWheelB
local steer = rightwheelB.Parent.Steer

local speed = 80

script.Parent.Changed:Connect(function(proprety)
	leftwheelF.AngularVelocity = speed * script.Parent.Throttle
	leftwheelB.AngularVelocity = speed * script.Parent.Throttle
	rightwheelB.AngularVelocity = speed * -script.Parent.Throttle
	rightwheelF.AngularVelocity = speed * -script.Parent.Throttle
	steer.TargetAngle = 15 * -script.Parent.Parent.Parent.Steer
end)

I don’t know if im doing something right or not and i don’t understand the error as i have no experience with hinges and vehicle seats, i tried to look upon that tutorial for the script but i feel like it’s outdated or maybe the car model (that i built myself) doesnt fit the structure for the script to work well?

I checked if everything is parented correctly and i don’t see any issue

If i did something wrong and you know how to fix this please let me know, and if you think that the script doesnt fit the car and i should look upon another tutorial and learn from other ressources then please let me know as well i never scripted a car before :sob:

1 Like

try

steer.TargetAngle = 15 * -steer.CurrentAngle
2 Likes


it fixed the error but then my car simply doesnt move, it looks like it’s carrying the body of the car super heaviely (nothing is anchored so idk why it’s doing that)

Could you try making all the parts Massless and send the results?

1 Like

Yeah i’m gonna stop posting here but the issue has been resolved regarding that script so thanks for the help given, if someone has a similar issue as me i recommend watching this tutorial, it explains pretty well what constraits and springs are

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.