Setting up chairs for a game

So, I am trying to make a musical chairs game but am having struggles on trying to figure out a way to make the game fair when it comes to trying to place the seat models in the right place depending on the amount of players in a script. Anybody have any ideas on how I could accomplish something like this or what is the best way?

Example:

This is for 12 players in the game:

image

This is for 3 players in the game:

image

1 Like

Use something like:

if game.Players.NumPlayers == game.Players.NumPlayers + 1 then
local clone = chair:Clone()
clone.Parent = game.Workspace
end

And then customise the vector qualities of the chair.

OR

Whenever a player joins the game, add them to a certain table, then check to see if the table numbers has risen.

1 Like

Your best bet would be to clone a predetermined set of chairs. Customizing the vector qualities would be useless code which could easily be avoided.

Let’s say you have 7 players currently playing (which you could store in a table). What you could do is go into ServerStorage and clone the amount of chairs relative to the amount of players. You could clone a model named “7”.

I suggest this method only because you’re not cloning very much. You’re cloning about 10 chairs with about 10 parts each so it shouldn’t cause too much server strain.

Here’s some example code:

local ServerStorage = game.ServerStorage
local players = game.Players

local inGame = { }  -- this would contain the players

--when something happens, do
local amount = #inGame 
local name = tostring(amount)

local clone = ServerStorage:FindFirstChild(name)
clone:Clone().Parent = workspace
3 Likes

Alright, I got what you mean! Thanks for this, I was starting to give up because I couldn’t think of any other ways than how I thought of it.

1 Like

Thanks for the help, I have a good idea on how I am going to do it now!

2 Likes