This is a serverscript in ServerScriptService? Can anyone help me?
game.Players.PlayerAdded:Connect(function(player) workspace.ChildAdded:Connect(function(child) local plr = game.Players:FindFirstChild(child.Name) if child.Name == plr.Name then wait() local clone = script.Rank:Clone() clone.Parent = workspace:FindFirstChild(plr.Name).Head local rank = workspace:FindFirstChild(plr.Name.Head.Rank.Frame) rank.Team.Text = plr.Team.Name rank.Team.TextStrokeColor3 = plr.TeamColor.Color rank.Name.Text = plr.Name end end) end)
error is : attempt to index field 'Name' (a string value)
You're trying to set the textlabel's text to an instance and not the instance's name.
To fix this do:
local playertoset = workspace:FindFirstChild(player.Name) playertoset.Head.Rank.Frame.Team.Text = player.Team.Name
on line 6.