Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I limit how many people can be teleported to a single brick?

In my game I have everyone in the server teleport to one of 20 different teleporter bricks.

Now, everyone teleports at random but sometimes people are teleported to the same brick which is a problem. How could I change this script to check and make sure no two people are sent to the same brick?

Thanks for any help you give!

tele = teles[math.random(1,#teles)]
						x1 = tele.Position.X-(tele.Size.X/2)
						x2 = tele.Position.X+(tele.Size.X/2)
						z1 = tele.Position.Z-(tele.Size.Z/2)
						z2 = tele.Position.Z+(tele.Size.Z/2)
						obj.Character.Torso.CFrame = CFrame.new(math.random(x1,x2),tele.Position.Y+5,math.random(z1,z2))	
						balanced = false
					else

1 answer

When a player teleports, remove the corrosponding teleporter from the table using table.remove. After everyone is teleported, re-add all the teleporters to the table.

This discussion is preserved as it was. New answers, comments, and votes are closed.