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

[URGENT] My Round Script is not showing the winners correctly at the end of the round?

So in my round script it should put all the survivors names on a TextLabel GUI. Here is the part from the script which should make it happen:

local winners = {}
	for i, v in pairs(plrs) do
		if v:FindFirstChild("Tag") then
			v:FindFirstChild("Tag"):Destroy()
			v:WaitForChild("leaderstats"):WaitForChild("Survivals").Value = v:WaitForChild("leaderstats"):WaitForChild("Survivals").Value + 1
			v:WaitForChild("leaderstats"):WaitForChild("Points").Value = v:WaitForChild("leaderstats"):WaitForChild("Points").Value + 5
			local t = v:WaitForChild("PlayerGui"):WaitForChild("Status"):WaitForChild("Winners")
			table.insert(winners,v.Name..", ")
		end
	end
	for i, v in pairs(plrs) do
		local t = v:WaitForChild("PlayerGui"):WaitForChild("Status"):WaitForChild("Winners")
		t.Visible = true
		if #winners >= 1 then
			t.Text = tostring(winners).." survived!"
		else
			t.Text = "Nobody survived!"
		end
		wait(5)
		t.Visible = false
	end

When I am testing, instead of it saying PrismaticFruits survived!, it says table: 0xd464664a068ce575 survived!. And each time that "player's name" keeps changing to a different one.

Could someone please point out where I went wrong?

1 answer

✓ Accepted answer

Could it possibly be that you are either trying to tostring() a Player instance, or trying to tostring() a player.Name value, which should already be a a string? Wait a minute, are you trying to call tostring on the table, because that would also not work

4 comments

0

If you are trying to call tostring on a table, try table.unpack

0

I tried without tostring and it did not work.

0

Would this work: t.Text = tostring(table.unpack(winners,1,#winners)).." survived!"

0

Yes that did work, thanks!

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