Why does this happen when I teleport a player to a seat

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want a player to go to a seat and it is a separate for each player

  1. What is the issue? Include screenshots / videos if possible!

it keeps teleporting till its the same seat

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I Tried adding a wait

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

for i,v in ipairs(game.Players:GetPlayers()) do
	for amt,Chair in ipairs(game.Workspace:GetChildren()) do
		if Chair.Name == "Chair" then
			if Chair.Seat.Occupant == nil then
				v.Character.Humanoid.WalkSpeed = 0
				v.Character.Humanoid.JumpPower = 0
				v.Character.HumanoidRootPart.CFrame = Chair.Seat.CFrame * CFrame.new(0,1.2,0)							 

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Alright so first things you want to do is put a bool value in all the chairs called isTaken, after that loop through the chair and put a player in the chair; after you put them in the chair; find the bool value you made and set it to true and continue the loop but only if the chair’s bool value isTaken is set to false


If that doesnt work I also have another possible solution for you

Mind Telling that in case if it does not work( i might said it rudely sorry)

Alright it consists of changing all the chairs names, so basically instead of checking if the chairs name we check if the chairs name is inside of the takenChairs and if its not we put a player inside of it, and if it is then we do nothing

local takenChairs = {}

for i,player in ipairs(game.Players:GetPlayers()) do
	for index, chair in ipairs(game.Workspace:GetChildren()) do
		if not table.find(takenChairs,chair.Name) then
			print("This chair hasn't been taken yet!")
			-- do stuff
			print("This chair is already occupied")