I am making a teamchanger gui that works by group, and I have a "Current Team Indicator" text in the gui, but I need to check first if the player is on the team before showing him on what team he is. I made this script but it says the player is not a valid member of Players, the gui is in playergui
function hello(onClick) local PlayerService = game:GetService("Players") local localplayer = script.Parent.Parent.Parent.Parent.Parent local Team = game:GetService("Teams")["Class - D"] if PlayerService.localplayer.Team == Team then print("he is on team1") -- the print is there just so I know it worked end end script.Parent.MouseButton1Click:Connect(hello)
Okay, I actually fixed it somehow by putting it into localscript and deleting fourth line and fixing seventh line to this ~~~~~~~~~~~~~~~~~ if PlayerService.localplayer.Team == Team then ~~~~~~~~~~~~~~~~~