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
4 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 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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

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

if that does not work try this

01game.Players.PlayerAdded:Connect(function(player)
02 
03    local GamepassID = 17441333
04 
05    local start1 = Instance.new("BoolValue")
06    start1.Name = "start1"
07    start1.Parent = player
08    start1.Value = false
09 
10if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,GamepassID) then
11    start1.Value = true
12end
13end)

Answer this question