Hello everyone,
I’ve seen some very interesting tech on ROBLOX, and one of them is a seat booking system. For example, with an airline self check-in system, passengers can select which seat they want out of all the seats in an aircraft.
This has made me somewhat curious as to how this functions. How would I go about assigning each seat in an aircraft a number if the seat layout varies from aircraft to aircraft? Additionally, how would I make passengers only able to sit in the seat they booked?
If anyone’s got any suggestions, they would be much appreciated. Thanks for your help.
One, I’d recommend looking at the actual documentation for Seats. Seat | Documentation - Roblox Creator Hub
Second, if you want to automatically assign a seat, you have a few options.
Have some a table with all your seats, and your occupants. Ex:
local seats = {
[seat1] = nil --no occupant
}
Then, you could loop through that array and find an empty seat. Or, you can have a table with only the available seats, and a table with taken seats. So you can randomly pick from available seats, and then if someone tries to sit within a seat, you can check the table of taken seats, to see if they sit there. If they don’t sit there, you can set the occupant to nil to break the weld.
Hope that helps.
2 Likes
This wouldn’t be hard, but the main thing I’m worried about is how to assign seat numbers to every seat if seat layout varies from aircraft to aircraft.