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

Beta Access not functioning?

Asked by 3 years ago

Hello, everyone! I was trying to script something when I discovered that it wasn't working. Is anyone able to assist me? I would appreciate every single help. I wanna check if they have a the gamepass, if they don't I check if they are in the for i,v list, if they are not, I want to kick them.

Here is my script:

local Premium = {0}
local MPS = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)   
        game.Players.PlayerAdded:Connect(function(plr)
            if MPS:UserOwnsGamePassAsync(plr.UserId,1031940432432423432402) then
                print("User joined with Beta Access Gamepass!")
            else    
                for i,v in pairs (Premium) do
                    if v == player.UserId then
                        print("Beta Access was given to this user manually.")
                    else
                        plr:Kick("You sadly do not have access to Beta Version.")
                    end
                end
            end 
        end)
    end)
end)
0
errors? if not, what prints kkfilms_1 68 — 3y
0
502: API Services rejected request with error. HTTP 403 (Forbidden) This is the only error, it may be another script however. ggAmazingMan 32 — 3y
0
what prints. Also, you don’t need another PlayerAdded kkfilms_1 68 — 3y
0
'14:21:12.458 - Argument 1 missing or nil' ggAmazingMan 32 — 3y

1 answer

Log in to vote
0
Answered by
Sparks 534 Moderation Voter
3 years ago
Edited 3 years ago

From Roblox Studio, click the Game Settings from the Home tab, go to Options, and turn "Enable Studio Access to API Services" on.

EDIT: Noticed you also had a second PlayerAdded listener. That is unnecessary. Since you are checking for beta access and kicking if they don't have it, you only need to listen to PlayerAdded once instead of CharacterAdded.

local Premium = {0}
local MPS = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(plr)
    if MPS:UserOwnsGamePassAsync(player.UserId,1031940432432423432402) then
        print("User joined with Beta Access Gamepass!")
    else    
        for i,v in pairs (Premium) do
            if v == player.UserId then
                print("Beta Access was given to this user manually.")
            else
                plr:Kick("You sadly do not have access to Beta Version.")
            end
        end
    end
end)
Ad

Answer this question