PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

VehicleSeat.Occupant

VehicleSeat.Occupant

Oct 01 2018, 1:44 AM PST

local seat = workspace.Car.Seat
seat.Changed:Connect(function(property)
    if property ~= 'Occupant' then return end

    local occupant = seat.Occupant
    if occupant then
        local character = occupant.Parent
        local player = game.Players:GetPlayerFromCharacter(character)
        if player then
            print(("Player %q just sat on the seat"):format(player.Name))
        else
            print(("NPC %q just sat on the seat"):format(character.Name))
        end
    else
        print("Someone left the seat")
    end
end)