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

if own gamepass continue else ask to buy ?

Asked by
RoyMer 301 Moderation Voter
9 years ago

So this script is supposed to check if the person owns the gamepass, and if he owns the gamepass it will do the following... if the person does not own the gamepass it should ask to purchase.

What is happening, it is just asking to purchase instead even tough I own the gamepass.

local player = game.Players.LocalPlayer 

function Click()

local id = 281057715    
if game:GetService("GamePassService"):PlayerHasPass(player, id) then

player.PlayerGui.ScreenGui.Extras.HorseColours.Visible = true
player.PlayerGui.ScreenGui.Extras.TycoonColours.Visible = false
player.PlayerGui.ScreenGui.Extras.Tracks.Visible = false

else
game:GetService("MarketplaceService"):PromptPurchase(player, id)    
end
end

script.Parent.MouseButton1Down:connect(Click)
0
It is a local script RoyMer 301 — 9y

1 answer

Log in to vote
0
Answered by
Mr1Vgy 30
9 years ago

Try using this instead of the GamePassService

game:GetService("MarketplaceService"):PlayerOwnsAsset(plr, id)

I just find it to be easier to use, plus the players don't have to rejoin for them owning the pass to register.

0
thanks :) RoyMer 301 — 9y
Ad

Answer this question