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

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

Asked by 5 years ago
Edited 5 years ago

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
0
player.UserId in line 8 not player brok4d 77 — 5y
0
Does not help. namespace25 594 — 5y
0
You may be saying the same thing below brok4d 77 — 5y
0
What do you mean? namespace25 594 — 5y
View all comments (4 more)
0
14:25:10.675 - UserOwnsGamepassAsync is not a valid member of Player namespace25 594 — 5y
0
market:UserOwnsGamepassAsync not player Vulkarin 581 — 5y
0
Thanks namespace25 594 — 5y
0
You're welcome Vulkarin 581 — 5y

2 answers

Log in to vote
0
Answered by
HaveASip 494 Moderation Voter
5 years ago
Edited 5 years ago

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

0
Still get the error: UserOwnsGamepassAsync is not a valid member of Player namespace25 594 — 5y
0
Try UserOwnsGamePassAsync p with the capital HaveASip 494 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)

Answer this question