How would I be able to make a script that detects if a player is in a certain group and has a certain group role when joining the game?
Use a playeradded event. You can use IsInGroup to detect if they are in the group.
There are two functions you can use:
Player:GetRankInGroup(GROUP ID) -> Returns the player rank (example: 5)
Player:GetRoleInGroup(GROUP ID) -> Returns the player role (example: Group Member)
2 Likes
if Player:GetRankInGroup(GROUP_ID_HERE) Operator RankValue then
-- Stuff that happens if they meet the requirement
end
Reaplce GROUP_ID_HERE with the ID of your Group.
Operator gets replaced with one of these:
Source: Conditional Structures
RankValue gets replace with the rank they need.
There is also ``:GetRoleInGroup()`` which will print the Player's Group Role.
If you need more info:
https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup
https://developer.roblox.com/en-us/api-reference/function/Player/GetRoleInGroup
1 Like