Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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)

0
How is it not working? Any errors? User#30567 0 — 4y
0
Remember to pcall Async functions User#30567 0 — 4y
0
It did not show any errors maddiesswrld 30 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Ad

Answer this question