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

Gamepass detection script not working properly?

Asked by 6 years ago

I'm trying to make a script where it shows you if you have the gamepass or not, but it simply isn't working or anything. Yes I do have the gamepass obviously.

-- Gamepasses Script 
-- Written by CarlPIandog

-- // Extra Freight Gamepass \\
local passId = 4657110 -- change this to your game pass ID.

function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
script.Parent.ExtraFreight.Visible = true
    end
end)

-- // Gamepass \\
-- Copy and paste rest above 

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, CarlPIandog!

I changed the part where you test if player owns a asset to if player owns a gamepass

-- Gamepasses Script 
-- Written by CarlPIandog

-- // Extra Freight Gamepass \\
local passId = 4657110 -- change this to your game pass ID.

function isAuthenticated(player) -- checks to see if the player owns your pass
    return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
script.Parent.ExtraFreight.Visible = true
    end
end)

-- // Gamepass \\
-- Copy and paste rest above 


Hope this helps!

Good Luck with you games

0
It still doesn't work for some reason. CarlPlandog 20 — 6y
0
any errors? Leamir 3138 — 6y
0
Nope. CarlPlandog 20 — 6y
0
Is the gamepass id correct? Leamir 3138 — 6y
0
Yes CarlPlandog 20 — 6y
Ad

Answer this question