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

I own the gamepass but its returning false?

Asked by 5 years ago
Edited 5 years ago

local Gamepasses = { ["3025362"] = game.ServerStorage.Items.Passes["Boombox"], -- ["3025376"] = game.ServerStorage.Items.Passes["Fists"], ["3025369"] = game.ServerStorage.Items.Passes["HandlessSegway"], ["3025380"] = game.ServerStorage.Items.Passes["P226"], ["3025365"] = game.ServerStorage.Items.Passes["ProtestSign"], -- ["1233826172"] = game.ServerStorage.Items.Passes["Pump"], } function CheckPasses(Player) print('checking') print(Player) local Market = game:GetService("MarketplaceService") for PassID,PassTool in pairs (Gamepasses) do print(Market:PlayerOwnsAsset(Player, PassID)) if Market:PlayerOwnsAsset(Player, PassID) then PassTool:Clone().Parent = Player.Backpack end end end game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function() CheckPasses(Player) end) end)

I own the gamepass but its returning false when I try and print it to see if it is returning true or false for some reason anyone know why?

0
Delete the -- on 3025376 and 1233826172, first of all. ChasingNachos 133 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

An update was made to game passes in April of 2018. This update made game passes not be assets anymore. You can use the new method :UserOwnsGamePassAsync(). Note that instead of the player, it is their UserId.

local Gamepasses = {
    [3025362] = game.ServerStorage.Items.Passes["Boombox"],
--  [3025376] = game.ServerStorage.Items.Passes["Fists"],
    [3025369] = game.ServerStorage.Items.Passes["HandlessSegway"],
    [3025380] = game.ServerStorage.Items.Passes["P226"],
    [3025365] = game.ServerStorage.Items.Passes["ProtestSign"],
--  [1233826172] = game.ServerStorage.Items.Passes["Pump"]
}
local Market = game:GetService("MarketplaceService")

local function CheckPasses(Player)
    print("checking")
    print(Player)
    for PassID, PassTool in pairs (Gamepasses) do
        if Market:UserOwnsGamePassAsync(Player.UserId, PassID) then
            PassTool:Clone().Parent = Player.Backpack
        end
    end
end

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function()
        CheckPasses(Player)
    end)
end)

0
Don't forget to accept if this helps! User#24403 69 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago
local Gamepasses = {
    ["3025362"] = game.ServerStorage.Items.Passes["Boombox"],
    ["3025376"] = game.ServerStorage.Items.Passes["Fists"],
    ["3025369"] = game.ServerStorage.Items.Passes["HandlessSegway"],
    ["3025380"] = game.ServerStorage.Items.Passes["P226"],
    ["3025365"] = game.ServerStorage.Items.Passes["ProtestSign"],
  ["1233826172"] = game.ServerStorage.Items.Passes["Pump"],
}


function CheckPasses(Player)
    print('checking')
    print(Player)
    local Market = game:GetService("MarketplaceService")
    for PassID,PassTool in pairs (Gamepasses) do
        print(Market:UserOwnsGamePassAsync(Player, PassID))--it is now UserOwnsGamePassAsync (they changed it you are trying to sell a  model/place and give them stuff for it) since some time they changed it (I have no idea when I was off ROBLOX Studio and stuff for like 4 months of 2018. 
        if Market:UserOwnsGamePassAsync(Player, PassID) then --same thing here
            PassTool:Clone().Parent = Player.Backpack
        end
    end
end

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function()
        CheckPasses(Player)
    end)
end)

0
-1 for not giving an explanation. User#24403 69 — 5y
0
dude srsly? i did thruout the script line 16 and 17. WideSteal321 773 — 5y
0
where he whent wrong. WideSteal321 773 — 5y
0
No. You did not. That doesn't explain why your solution works. User#24403 69 — 5y
0
fine i'll just stop trying WideSteal321 773 — 5y

Answer this question