I have a script that should have the team name of the team the player is on but it seems not work what went wrong with it? By the way, the script is a normal script, not a local script and its location is in the workspace, and finally it's not a group team just a Roblox ingame team
---Script---
game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
wait(1)
if game.Players.LocalPlayer.Team == "Adult" then--Put your name here.
gui=Instance.new("BillboardGui")
gui.Parent=newPlayer.Character.Head
gui.Adornee=newPlayer.Character.Head
gui.MaxDistance = 100
gui.Size=UDim2.new(3,0,3,0)
gui.StudsOffset=Vector3.new(0.5,2,0)
text=Instance.new("TextLabel")
text.Text = ("Parent")
text.Font = "Legacy"
text.TextColor3 = Color3.new(234, 252, 0)
text.Size=UDim2.new(0.5,0,0.5,0)
text.FontSize = 'Size32'
text.Position=UDim2.new(-0.125,0,-0.25,0)
text.BackgroundTransparency = 1
text.Parent=gui
end
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
