--When a player enters the game, I insert a Boolean Value into them and set it to false. When they step onto a pad, I set the Boolean value to true. Then before the round starts I compile a list of players that have a Boolean Value of true and teleport them into the round. It normally teleports all the players, but sometimes, a player is left behind. Is it some sort of timing problem or am I messing up the table? Thanks! Oh, I guess I should add, they can't step onto the pad until the current round is over in order to to join the next round.

--Script when they enter setting the Boolean value to false

function newPlayer(player)
	local SurvivorList = Instance.new("BoolValue")
	SurvivorList.Name = "SurvivorList"
	SurvivorList.Parent = player
	SurvivorList.Value = false
end

--script inside the pad that sets the Boolean to true

debounce = false
script.Parent.Touched:connect(function(hit)
	if debounce == false then
		debounce = true
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
			if plr then 
				local status = plr:FindFirstChild("SurvivorList")
				status.Value = true
			end
		wait(4)
		debounce = false
	end
end)

--function compiling players for the round

function Compilesurvivors(v)
	for i, v in pairs(game.Players:GetChildren()) do
		if v.Name == survivors[i] then return
		else
			if v.SurvivorList.Value == true then
				table.insert(survivors, v.Name)
			end
					v.Character.Humanoid.HealthChanged:connect(function()
					died(v.Name, v.Character.Humanoid) 
					end)
		end
				
	end
end

--script where they are teleported into the round in the game

Compilesurvivors()
	wait(5)
	for i, v in pairs(survivors) do
		local player = game.Players:FindFirstChild(v)
		wait(1)
			if player then
		        player.Character:MoveTo(Vector3.new(-74.166, 4.362, -14.037))
			end
	end

3 comments

0

From a first look everything seems fine. My best guess would be that multiple people step on the pad during the debounce, thus the 2nd+ player to step on doesn't trigger the event because of the debounce.

0

Yeah. I thought a timing issue. I had a really short debounce, but it was executing that script constantly as they stood there. I thought maybe I could teleport them as they step on then compile the list, but that causes an issue too. I think my logic is just really flawed.

0

Oh thanks Griift, I think I figured out where my logic is flawed, and you were the catalyst for that. :)