Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

player.Team doesn't work? [THANKS FOR HELP!]

redGui = game.StarterGui.ScreenGui.RedUpgradeGui:Clone() game.Players.PlayerAdded:Connect(function(player) if player.Team == "Inferno" then player.PlayerGui.ScreenGui.RedUpgradeGui.Visible = true player.PlayerGui.ScreenGui.RedUpgradeGui.Active = true end

end)

So, the GUI doesn't get visible or active... Is this the way to do it?? Or is there another way??

6 comments

0

Hit me up on discord and i will help you out. Casper#0357

0

^^

0

Will do, just need to get home from school! I'll add you later.

0

if player.Team.Name == "Inferno" then?

0

Guess I should explain. ;p You're comparing the Team itself to a string, when you should be comparing its name Team.Name. ;)

0

Ok will check

1 answer

The fisrt and major thing is that you are using a string value where an object value is required. Player.Team = _object_value_ is what needs to happen. Said object needs to be a team object. Say you have 2 teams: Team1 and Team2. The player is on Team1 and you want them to change to Team2. Instead of saying game.Players.LocalPlayer.Team = "Team2", it wants

local T2 = game:getService("Teams"):FindFirstChild("Team2")

game.Players.PlayerAdded:Connect(function(plr)
	plr.Team = T2
end)

2 comments

0

Also want to point out you could probably just get all people in a team and loop through them all. To me it sounds more efficient and less scripts running at the same time.

0

Your example did not work.

This discussion is preserved as it was. New answers, comments, and votes are closed.