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

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?

3 answers

✓ Accepted answer

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. ;)

1 comment

0

Thank you for posting an actually helpful response. Vouch.

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

Please do some more research and next time give us some more information! I highly suggest you research teams and remote events, they will probably help you here! If I helped in the slightest please accept this answer!

4 comments

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.

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.

0

Also I meant groups on the website lmao.

0

oh sorry lol

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