Knowing if a vehicle seat is occupied?

How do you know if a vehicleseat is occupied?
i tried: `local seat = script.Parent.VehicleSeat
if seat.Disabled == true then print(“occupied”)

end`
But it did not work.

VehicleSeats and Seats have an Occupant property that you can use to check if a seat is occupied or not. When someone sits on the seat, its Occupant property will change to the Humanoid of whoever is sitting, if no one is sitting, then nothing is stored in the property. You can do a simple script such as this

local seat = script.Parent.VehicleSeat

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    local humanoid = seat.Occupant
    if humanoid then
        print(humanoid.Parent.Name.. " is sitting on the seat")
    end
end)

Which will print whoever is sitting on the seat plus some more text

1 Like