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

How do I make it so the game kicks people that aren't a group rank or dont have a gamepass?

I am making a gamepass that will allow people to see my beta game, if they don't have it they will be kicked. But, I want to make it so a certain group rank can still play without the gamepass, such as the developers. Can someone help? I'm bad at this stuff, lol.

this is what I tried, but it does not work.

local MPS = game:GetService("MarketplaceService")
local ID = 11377785
local Player = game:GetService("Players").LocalPlayer

game.Players.PlayerAdded:Connect(function(plr)
    if MPS:UserOwnsGamePassAsync(plr.UserId,ID) then
      elseif Player:GetRankInGroup(5791590) <= 255 then

    else
        plr:Kick("You do not own the required gamepass.")
    end
end)

3 comments

0

How is it not working? Any errors?

0

Remember to pcall Async functions

0

It did not show any errors

1 answer

Try this one here it should work

local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassId = 11377785
local GroupId = 5791590
local RequiredRank = 255
local KickMessage = "You do not own the required gamepass."
game.Players.PlayerAdded:Connect(function(player)
	if not MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) and player:GetRankInGroup(5791590) <= 255 then
		player:Kick(KickMessage)
	end
end)

tell me if it works

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