I’m trying to make a system where players can rent rooms for a certain amount of time and invite their friends to the room, and I have it mostly done, but there’s one problem. I have no idea how to make it so if someone is already renting the room, nobody else can rent it until that person leaves. How would I start?
A Couple of ways:
Create a table
to store records of Rooms, you can Assign a Variable to that a room to indicate that a person owns the Room, you can either:
-
use a
for
loop to iterate through thistable
and check if the table exists for that room -
Use
table.find()
to get theindex
for the room, if the key doesnt exist, it will returnnil
, otherwise, it will return anumber
.
Use an ObjectValue
to store the Owner of the Room, So when Players attempt to get the room, You can check the Values
of the ObjectValue
to determine this, You might also be able to use a for
loop for this.
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.