Ad
Log in to vote
0

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

Asked by
Oficcer_F 173
2 months ago
Edited 2 months 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 359 — 2mo
0
^^ casper123123123 359 — 2mo
0
Will do, just need to get home from school! I'll add you later. Oficcer_F 173 — 2mo
0
`if player.Team.Name == "Inferno" then`? TheeDeathCaster 2119 — 2mo
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 2119 — 2mo
0
Ok will check Oficcer_F 173 — 2mo

1 answer

Log in to vote
1
Answered by 2 months 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 359 — 2mo
0
Your example did not work. Oficcer_F 173 — 2mo
Ad

Answer this question