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

Why is this prompting a shirt and not my gamepass?

Why is this prompting a shirt and not my gamepass?

Id = 5409221

script.Parent.Touched:connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, Id) then
			script.Parent.Transparency = 1
			script.Parent.CanCollide = false
		        wait(1)
	 	        script.Parent.Transparency = 1
			script.Parent.CanCollide = true
			else
			game:GetService("MarketplaceService"):PromptPurchase(player,Id)
	     


	end
	end
end)

1 comment

0

wth i put effort in my answer all he wrote was a sentence

2 answers

Your code:

Id = 5409221

script.Parent.Touched:connect(function(hit)
    if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, Id) then
            script.Parent.Transparency = 1
            script.Parent.CanCollide = false
                wait(1)
                script.Parent.Transparency = 1
            script.Parent.CanCollide = true
            else
            game:GetService("MarketplaceService"):PromptPurchase(player,Id)



    end
    end
end)

The problem:

Since I believe April 2018 they have changed it gamepasses are no longer in library yet there separate thing and no longer a item yet it is a GamePass (why it is now PromptGamePassPurchase not PromptPurchase ) PromptPurchaseis purchasing a library/catalog item.

Fixed code:

Id = 5409221

script.Parent.Touched:connect(function(hit)
    if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, Id) then
            script.Parent.Transparency = 1
            script.Parent.CanCollide = false
                wait(1)
                script.Parent.Transparency = 1
            script.Parent.CanCollide = true
            else
            game:GetService("MarketplaceService"):PromptGamePassPurchase(player,Id)



    end
    end
end)

btw I used some stuff from an old answer of mine

Recourses:

:PromptGamePassPurchase

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