Hello! I am making a gamepass that will allow people to see beta versions of the game. I want the game to kick them if they dont have it, but if they are a certain group rank they will not be kicked even without the gamepass. How would I do this?
It is not selling a rank. It is a premium gamepass that gives the player access to see beta versions. The only other people who would have access to the game without the gamepass is a certain group rank such as the developers+ for testing.
I know but I am making a gamepass with a lot of perks and I want that to be one of them. And I don’t want the developers to have to pay to test the game.
You’re going to make a whitelist, as I can see?
You will need to use the player object then Player:GetRankInGroup(groupId)
to get the rank’s value. For gamepass, MarketplaceService:UserOwnsGamePassAsync(Player.UserId, gamePassId)
.
Altogether should be read using Players.PlayerAdded
. If they are not in the whitelist, Player:Kick()
.
References:
:IsInGroup(), :GetRankInGroup() and :GetRoleInGroup() are cached on the server.
I would suggest using GroupService.
It would be very annoying if they joined the group and couldn’t join the server because it’s already cached when they join once.
Not sure how you would use GroupService
, as it seems to be only useful for group allies and enemies management. Besides, there’s a note in the GroupService
page.
Additionally, the methods are cached on server as you have previously mentioned:
You would use GroupService
to confirm its membership of a group for extra measurements. The only inconvenience is when they leave the group during the time in the server and it would say they are in the group.
It would be very annoying if they joined the group and couldn’t join the server because it’s already cached when they join once.
As I mentioned, it would be annoying if there was any rewards included and you’d need to join another server or wait until a server has been updated (if this is not the reason, then OP can get away with the cached methods).
GroupService is a top service class, and has multiple purposes over the cached methods.
I made a GroupServiceModule that I can require to verify their role, rank and if they’re currently in the group or not.
Overall, I like to have control over things like this.
Since GroupService exists, I do recommend using it.
(GroupService)
I would agree that its usage should not be used if they wish to verify their membership in a group (using Player:IsInGroup()
), however its result is cached on the server, which I personally find a bit frustrating when relying on rewards and rank systems which is group based.
Solution
In this case specifically, Player:IsInGroup()
would be fine to use.