I’ve worked on a game recently, and I want to make a GUI that displays the Player’s team. However, the script i made didn’t work. I have also looked throughout the devforum and devhub, nothing helped.
My script is stored inside of a LocalScript object:
Adding an event will ensure that it fires for the client only. Make sure the object location or GUI is directed to the PlayerGui. (player.PlayerGui..Text =…)
Try localPlr.Team.Name, since the Team property is actually an Instance.
However, you probably want to hook up a function whenever the team changes:
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Label = script.Parent
local function onTeamChanged()
Label.Text = LocalPlayer.Team.Name
end
if LocalPlayer.Team then onTeamChanged() end
LocalPlayer:GetPropertyChangedSignal("Team"):Connect(onTeamChanged)