Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

if own gamepass continue else ask to buy ?

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)

1 comment

0

It is a local script

1 answer

✓ Accepted answer

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.

1 comment

0

thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.