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

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

Asked by
Oficcer_F 207 Moderation Voter
5 years ago
Edited 5 years ago

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??

0
Hit me up on discord and i will help you out. Casper#0357 casper123123123 357 — 5y
0
^^ casper123123123 357 — 5y
0
Will do, just need to get home from school! I'll add you later. Oficcer_F 207 — 5y
0
`if player.Team.Name == "Inferno" then`? TheeDeathCaster 2368 — 5y
View all comments (2 more)
0
Guess I should explain. ;p You're comparing the `Team` itself to a string, when you should be comparing its name `Team.Name`. ;) TheeDeathCaster 2368 — 5y
0
Ok will check Oficcer_F 207 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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)
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. casper123123123 357 — 5y
0
Your example did not work. Oficcer_F 207 — 5y
Ad

Answer this question