How do I make people spawn in places that others didn't spawn in?

How do I create a script that makes people spawn on seats in different places than other players spawned?

Basically, what I’m trying to say is that, when someone joins a game, they spawn while sitting in a seat, but if there are more people in different seats, the person who joins the game cannot spawn in those seats. Instead, they spawn in a seat that is not taken by another person.

1 Like

You could make a bool value called “Taken” and if a person is sitting in it then set the bool value to true, and if the bool value is true, nobody else spawns there

1 Like

Can you make it more clear. I do not Understand

Check if the Seat.Occupant exists before spawning someone on the seat.

1 Like

Is it supposed to be a localscript or a normal script?

I made it a normal script, I’ll test it out with some of my friends.

You should be managing the spawning from a server script. The Seat.Occupant can only be accessed from ma server script.

This is the code I used:

spawnlocation = script.Parent
seat = script.Parent.Parent

while wait() do
	if seat.Occupant == "Humanoid" then
		spawnlocation.Enabled = false
	else
		spawnlocation.Enabled = true
	end
end

I made the script inside the SpawnLocation.

I’m not sure what I did wrong, but for some reason, the Enabled doesn’t change at all.

I tried that out, and it worked seamlessly! Thank you so much!

1 Like

Seat.Occupant is the humanoid object of the character sitting there, not a string value. Just check if seat.Occupant ~= nil