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

It shows up an error when I try to make a label that displays teams, help!?

Asked by
RootEntry 111
6 years ago

Hello, I know the title is confusing but I am trying to make a label display a text.

Error: "18:12:47.627 - Players.iiLevelMaker.PlayerGui.HUD.Frame.Level.LocalScript:10: attempt to concatenate field 'Team' (a userdata value)"

Script:

local player = game.Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui"):WaitForChild("HUD")
local label = gui:WaitForChild("Frame").Level

game.Players.PlayerAdded:connect(function()
    label.Text = "Level: "..player.Team
end)

game:GetService("RunService").RenderStepped:connect(function()
    label.Text = "Level: "..player.Team
end)

I tried doing player.Team.Value and player.Team.Text but neither works. Help me!

1 answer

Log in to vote
0
Answered by 6 years ago

I think it's because you have to turn that value into a string, try this:

label.Text = "Level: "..tostring(player.Team.Value)
Ad

Answer this question