IsInGroup (Method)
From Legacy Roblox Wiki
Jump to navigationJump to search
IsInGroup( integer groupId ) | |
Returns | boolean memberOfGroup |
Description: | Checks if the Player is in the group whose groupId is inputted as an argument. |
Member of: | Player |
LocalScript vs Script
Whenever you call IsInGroup using a normal script, you will not get the most up-to-date information. If a player leaves a group while they are in the game, IsInGroup will still think they are in that group until they leave. However, this does not happen in a LocalScript instance. A LocalScript will always return the most up-to-date information about the player's groups.
Example
game.Players.PlayerAdded:connect(function(newPlayer) -- Runs when a new player enters the game
if newPlayer:IsInGroup(7) then -- Checks if the player is in group 7 (Roblox fan club)
print "Player is in the Roblox Fan club!" -- Runs if the player is in group 7
end
end)