Still have questions? Join our Discord server and get real time help.
0

# How to check what groups a player is in?

In my game, I want a player to only be able to chose a certain role if they are in a specific group. How can I do this?

1

It's easy, just get the player from game.Players (or from "game.Players.PlayerAdded") and then check using "PartOfGroup = Player:IsInGroup(GroupID)". The ":IsInGroup()" checks if a player is in a group then returns a true or false value (which is stored in the "PartOfGroup" variable).

If you want the documentation itself check it here: https://developer.roblox.com/en-us/api-reference/function/Player/IsInGroup

If you have any questions or issues contact me. ;)

0
Thank you for posting an actually helpful response. Vouch. DejaSketch 82 — 7mo
0
zomspi 546
7 months ago

You really need to give us more info but here's what I can do with your info:

You can just use an if statement:

local player = game.Players.LocalPlayer
if player.Group == "Group" then -- change the group to your group path and change the "Group" to your group name, I highly suggest you use teams, this would make it a lot easier
role.Visible = true -- Again, change role to the path of your role
end


0
You don't actually need "RemoteEvents" nor "RemoteFunctions" for this if all he wants is the server to check if a player is part of a group. He just needs to use the ":IsInGroup()" function. lazycoolboy500 537 — 7mo
0
It's literally just activate something if a player is in a group. Didn't ask for you to write an entire script, I asked how to see if a player is in a group or not. DejaSketch 82 — 7mo
0
Also I meant groups on the website lmao. DejaSketch 82 — 7mo
0
oh sorry lol zomspi 546 — 7mo
0

Use Player:IsInGroup