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

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question