Hey devs, I’m looking to figure out how to make it that a script will automatically stop a car when a player exits the car. This is my script for far:
local seat = script.Parent
wheel1 = script.Parent.Parent.Parent.WheelBL.Wheel.Hub
wheel2 = script.Parent.Parent.Parent.WheelBR.Wheel.Hub
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant then
print("Driver in car")
else
print("No driver")
while true do
wait (0.1)
local wlsp = (wheel2.RotVelocity)
print(wlsp)
if wlsp <= 0.005 then
seat.Throttle = -1
end
end
end
end)
When I run the game, it gives me the error “Workspace.Car.Base.VehicleSeat.BrakeOnExit:13: attempt to compare Vector3 <= number”. Anyone know what is happening and how to fix it?