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

player is not a valid member of players ? [Answered]

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)

1 answer

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

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