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

how to make a script that sences a gamepass?

Asked by
xxaxxaz 42
3 years ago

I was making a gamepass for my game and I have litteraly no idea how to sence it. I already have the shop and everything I am just wanting to know how to make it work.

0
I am thinking something like a if statement xxaxxaz 42 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/UserOwnsGamePassAsync

if game:GetService'MarketplaceService':UserOwnsGamePassAsync(UserId, gamepassId) then
    print'player has gamepass'
end
0
thanks! xxaxxaz 42 — 3y
Ad
Log in to vote
0
Answered by
xxaxxaz 42
3 years ago

if that does not work try this

game.Players.PlayerAdded:Connect(function(player)

    local GamepassID = 17441333

    local start1 = Instance.new("BoolValue")
    start1.Name = "start1"
    start1.Parent = player
    start1.Value = false

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,GamepassID) then
    start1.Value = true
end
end)

Answer this question