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?
How to check what groups a player is in?
3 answers
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. ;)
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
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.
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.
Also I meant groups on the website lmao.
oh sorry lol
Use Player:IsInGroup
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you for posting an actually helpful response. Vouch.