function load_desert()
	local alive = {}
	for i,k in pairs(Players) do
		table.insert(alive,k.Name)
		print("added")
	end
	local squares = workspace.desert.Model.squares:GetChildren()	
	for i,k in pairs(squares) do --ignore this
		k.Touched:Connect(function()
			k.Transparency = 0.5
			wait(1)
			k.Transparency = 1
			k.CanCollide = false
			wait(2.5)
			k.Transparency = 0.7
			wait(3)
			k.CanCollide = true
			k.Transparency = 0
		end)
	end
	game:GetService("Players").PlayerAdded:Connect(function(player)
		player.CharacterAdded:Connect(function(character)
			character:WaitForChild("Humanoid").Died:Connect(function()
				for i,k in pairs(alive) do
					if k.Name == player.Name then
						table.remove(alive, i)
						print("died")
					end
				end
			end)
		end)
	end)
end

load_desert()

This code is supposed to add the players to a list and then if a player dies, he's removed from the list. But the messages added and died aren't printed.

Any suggestions?

3 comments

0

anyone?

0

Does the code actually run in the loop?

0

what do you mean? there are 2 for loops, the second one is for something else. The first one should iterate through players and add them in a list