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

Beta Access not functioning?

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)

4 comments

0

errors? if not, what prints

0

502: API Services rejected request with error. HTTP 403 (Forbidden) This is the only error, it may be another script however.

0

what prints. Also, you don’t need another PlayerAdded

0

'14:21:12.458 - Argument 1 missing or nil'

1 answer

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)

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