[Implemented] Seat.Occupant

I suggest the following members be added to the [tt]Seat[/tt] class:

Property Object Seat.Occupant [readonly]
Event Seat.OccupantAdded(Instance character)
Event Seat.OccupantRemoved(Instance character)

Seats can be occupied by non-player characters, so these members would respect that. The events are for convenience – it is possible to achieve the same thing by listening to [tt]Seat.ChildAdded[/tt].

1 Like

Shouldn’t the occupant be a reference to the humanoid object?

It certainly can be. Are there other places in the API which use the humanoid instead of the humanoid’s character model?

1 Like

Gois point, but why didn’t you just say that to him in… in person? You are brothers, right?

Gois point, but why didn’t you just say that to him in… in person? You are brothers, right?[/quote]

#MerelyIlluminati

Because other people may want to chime in, and we aren’t always in the same physical location.

1 Like
player = nil

seat.ChildAdded:connect(function(it)
if it.ClassName == "Weld" and it.Name == "SeatWeld" then
player = it.Part1.Parent
OnSit(it.Part1.Parent)
end
end)

seat.ChildRemoving:connect(function(it)
if it.ClassName == "Weld" and it.Name == "SeatWeld" then
OnStand(it.Part1.Parent)
player = nil
end
end)

We all know it’s programmatically possible to determine who’s sitting in a seat using the SeatWeld. However, it shouldn’t be necessary to learn about how ROBLOX creates SeatWelds in order to detect when the seat is occupied. This should be built-in, since it’s frequently asked about.

1 Like

Don’t twins have telepathy, though?

ON TOPIC: Yes, this feature would make sense and be a lot better than the haxy way we do it now. Support.

I wrote a small ModuleScript to do this:

http://www.roblox.com/SitDetector-API-item?id=185497368