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

[ SOLVED ]UserOwnsGamepassAsync is not a valid member of Player?

So whenever the game starts this script should be checking if someone has a VIP game pass; but insteed I get an error from the output that says: UserOwnsGamepassAsync is not a valid member of Player. Please help.

local VIP = require(script.Parent);
local WConfig = require(game.ServerScriptService.Windstone.Config);
local market = game:GetService("MarketplaceService");
local ID = VIP.infromation.vipID;
local clone

game.Players.PlayerAdded:Connect(function(player)
	if player:UserOwnsGamepassAsync(player,ID) then
		clone=VIP.infromation.vipLeaderstats.ui.vip:Clone();
		if player and player.Character and player.Character.Head then
			clone.Parent = player.Character.Head
		end
	end
	for var1,var2 in pairs(WConfig.Admins,WConfig.EliteAdmins) do
		if player.Name == var1 or var2 then
			clone=VIP.infromation.vipLeaderstats.ui.admin:Clone();
			if player and player.Character and player.Character.Head then
				clone.Parent = player.Character.Head
			end
		end
	end
end)

Output:

14:25:10.675 - UserOwnsGamepassAsync is not a valid member of Player

8 comments

0

player.UserId in line 8 not player

0

Does not help.

0

You may be saying the same thing below

0

What do you mean?

0

14:25:10.675 - UserOwnsGamepassAsync is not a valid member of Player

0

market:UserOwnsGamepassAsync not player

0

Thanks

0

You're welcome

2 answers

If you want to check that if player has that game pass you need to put his UserId then gamepass, so on the line 8 type this:

if player:UserOwnsGamepassAsync(player.UserId,ID) then

You can read more here

2 comments

0

Still get the error: UserOwnsGamepassAsync is not a valid member of Player

0

Try UserOwnsGamePassAsync p with the capital

Solved by Vulkarin

local VIP = require(script.Parent);
local WConfig = require(game.ServerScriptService.Windstone.Config);
local market = game:GetService("MarketplaceService");
local ID = VIP.infromation.vipID;
local clone

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(chr)
	if market:UserOwnsGamePassAsync(player.UserId,ID) then
		clone=VIP.infromation.vipLeaderstats.ui.vip:Clone();
		clone.Parent = chr.Head
	end
	for var1,var2 in pairs(WConfig.Admins,WConfig.EliteAdmins) do
		if player.Name == var1 or var2 then
			clone=VIP.infromation.vipLeaderstats.ui.admin:Clone();
				clone.Parent = chr.Head
			end
		end
	end)
end)

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