Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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:

01local winners = {}
02    for i, v in pairs(plrs) do
03        if v:FindFirstChild("Tag") then
04            v:FindFirstChild("Tag"):Destroy()
05            v:WaitForChild("leaderstats"):WaitForChild("Survivals").Value = v:WaitForChild("leaderstats"):WaitForChild("Survivals").Value + 1
06            v:WaitForChild("leaderstats"):WaitForChild("Points").Value = v:WaitForChild("leaderstats"):WaitForChild("Points").Value + 5
07            local t = v:WaitForChild("PlayerGui"):WaitForChild("Status"):WaitForChild("Winners")
08            table.insert(winners,v.Name..", ")
09        end
10    end
11    for i, v in pairs(plrs) do
12        local t = v:WaitForChild("PlayerGui"):WaitForChild("Status"):WaitForChild("Winners")
13        t.Visible = true
14        if #winners >= 1 then
15            t.Text = tostring(winners).." survived!"
View all 21 lines...

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

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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

0
If you are trying to call tostring on a table, try table.unpack JoRyJuKy 32 — 4y
0
I tried without tostring and it did not work. PrismaticFruits 842 — 4y
0
Would this work: t.Text = tostring(table.unpack(winners,1,#winners)).." survived!" PrismaticFruits 842 — 4y
0
Yes that did work, thanks! PrismaticFruits 842 — 4y
Ad

Answer this question