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

UserOwnsGamepassAsync Wont work help please?

Asked by 6 years ago

the following code does not work when i update it with the new gamepasses and doesnt notify the player or give the tools

local vip = 4503749

game.Players.PlayerAdded:connect(function(p) local tag = Instance.new("StringValue", p) tag.Name = "Tag" tag.Value = p.Name

if p.userId == 0 then for i,v in pairs(game.Players:GetChildren()) do if v and v:FindFirstChild("Backpack") ~= nil then local notif = game.ReplicatedStorage.Folder.StoredScripts.Notification:Clone() notif.Title.Value = "Developer Joined!" notif.Sub.Value = "Hi" notif.Parent = v.Backpack end end end

p.CharacterAdded:connect(function(char)

local function AreYouVIP() if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p.userId, vip) then if p and p:FindFirstChild("Backpack") ~= nil and p.Backpack:FindFirstChild("Screaming") == nil and p.Character:FindFirstChild("Screaming") == nil then local t = game.ReplicatedStorage.Tools.GamepassGear:FindFirstChild("Screaming"):Clone() t.Parent = p.Backpack local t2 = game.ReplicatedStorage.Tools.GamepassGear:FindFirstChild("Screaming"):Clone() t2.Parent = p.StarterGear

local notif = game.ReplicatedStorage.Folder.StoredScripts.Notification:Clone() notif.Title.Value = "Tool Received:" notif.Sub.Value = "Screaming has been added to your inventory!" notif.Parent = p.Backpack end

if p and p:FindFirstChild("Backpack") ~= nil and p.Backpack:FindFirstChild("Key Card") == nil and p.Character:FindFirstChild("Key Card") == nil then local t = game.ReplicatedStorage.Tools.GamepassGear:FindFirstChild("Key Card"):Clone() t.Parent = p.Backpack local t2 = game.ReplicatedStorage.Tools.GamepassGear:FindFirstChild("Key Card"):Clone() t2.Parent = p.StarterGear

local notif = game.ReplicatedStorage.Folder.StoredScripts.Notification:Clone() notif.Title.Value = "Tool Received:" notif.Sub.Value = "Key Card has been added to your inventory!" notif.Parent = p.Backpack end

if p and p:FindFirstChild("Backpack") ~= nil and p.Backpack:FindFirstChild("Fart") == nil and p.Character:FindFirstChild("Fart") == nil then local t = game.ReplicatedStorage.Tools.GamepassGear:FindFirstChild("Fart"):Clone() t.Parent = p.Backpack local t2 = game.ReplicatedStorage.Tools.GamepassGear:FindFirstChild("Fart"):Clone() t2.Parent = p.StarterGear

local notif = game.ReplicatedStorage.Folder.StoredScripts.Notification:Clone() notif.Title.Value = "Tool Received:" notif.Sub.Value = "Farting has been added to your inventory!" notif.Parent = p.Backpack end end end

local function UpdateTag() if p and p.Character and p.Character:FindFirstChild("Head") ~= nil then if p.Character.Head:FindFirstChild("BillboardGui") then p.Character.Head.BillboardGui:Destroy() end

AreYouVIP()

0
Use PlayerOwnsAsset instead Rare_tendo 3000 — 6y
0
Why? that is deprecated BitStreams 4 — 6y

2 answers

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

Yea, Gamepass-related functions seem to not work properly. What I suggest you to do is use PlayerOwnsAsset function of MarketplaceService, BUUUT in order to use it, you need to find the AssetId of your gamepass.

To do that, go to your gamepass page, right click anywhere on the page, click View Source, hit Ctrl + F to bring up the search dialog, enter data-item-id=. This is the AssetId of your gamepass that you can use with PlayerOwnsAsset.

If it seems too complex for you, I made an api for this purpose. All you need to do is input the gamepass id and it will give you its asset id.

local vip = 1766927952
(...)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(p.userId, vip) then
(...)
Ad
Log in to vote
0
Answered by 6 years ago

alright ill try it thanks u see anything else wrong with the code because userownsgamepassasync prints true/false meaning its working so..

Answer this question