I am working on a game where I have a custom playerlist with team support. However, I get this error that I don't understand. I do know it is an error when you forget to mention the ".Value" in a variable object. But this? Hmm...
Error:
17:24:16.069 - Players.iBoai.PlayerGui.CustomPlayerlist.MainFrame.PlayerListManager:12: attempt to concatenate field 'Team' (a userdata value)
Code:
wait(2) local teams = game:GetService("Teams") local teamLobby = teams:WaitForChild("Lobby") local teamKiller = teams:WaitForChild("Killer") local teamTestSubjects = teams:WaitForChild("Test Subjects") local labelModel = script.Parent.Model local lastSize = script.Parent.LastSize while script.Parent.Visible == true and wait(0.1) do for i,v in pairs(game.Players:GetChildren()) do local newLabel = labelModel:Clone() newLabel.Text = "["..v.Team.."] "..v.Name newLabel.Position = UDim2.new(1, 1, 0, lastSize.Value) newLabel.Visible = true lastSize.Value = lastSize.Value + 50 end end
What the heck am I doing wrong? Hmm...
Since the team is an Object, when you try to concatenate it using ..
it errors. To fix this, all you should need to do is get the team's Name, which is a string.
"[" .. v.Team.Name .. "]"