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
1 comment
wth i put effort in my answer all he wrote was a sentence