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

My roblox Rounds Table is not working which takes away players on death?

i made this script here which is supposed to Add a Player at the start of the round and then change the value to who survived at the End!

local list = {}
local D = game.ReplicatedStorage:WaitForChild("Status")
while true do
	wait(1)
for i, player in ipairs(game.Players:GetChildren()) do
table.insert(list, ""..i.."")
wait(10)
D = ""..list[i].." Survived"
wait(99999)
end end

game:GetService('Players').PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
			table.remove(list,player.Name)
		end)
	end)
end)

1 answer

✓ Accepted answer

Create a script that adds a StringValue to the Player.

game:GetService('Players').PlayerAdded:connect(function(player)
	local stringvalue = Instance.new("StringValue")
	stringvalue.Name = "Status"
	stringvalue.Parent = player
	stringvalue.Value = "Alive"
end)

You can change the Status value to "isDead" or "Dead" when the player dies (Humanoid.Died:connect(function()) and when the round ends, check all of thee players Status value if it is "Dead" or "Alive"

for _, v in pairs(game.Players:GetChildren()) do 
	if v:FindFirstChild("Status") then 
		local player = v
		local plrstatus = player:FindFirstChild("Status")
		
		if plrstatus.Value == "Alive" then 
			print("" .. player.Name .. " survived!")
		
		elseif plrstatus.Value == "Dead" then 
			print("" .. player.Name .. " died!")
		end
	end
end

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