Hey there,
i need help.
Im making an gamepass purchase for my Billboard, but when i click the button nothing shows up. I get no errors.
These are the locations:
And this is my code:
local marketplace = game:GetService("MarketplaceService")
local gamepassID = 63421396
local plr = game.Players.LocalPlayer
local button = script.Parent
button.MouseButton1Click:Connect(function()
local hasPass = marketplace:UserOwnsGamePassAsync(plr.UserId, gamepassID)
if hasPass then
print("the user owns the gamepass")
else
marketplace:PromptGamePassPurchase(plr,gamepassID)
end
end)
Also its a local script u can see it there.
Could someone help? If yes thank you!
change it to a normal script, local scripts don’t run in workspace
instead of the player variable, put player in the parameters of the click function
local marketplace = game:GetService("MarketplaceService")
local gamepassID = 63421396
local button = script.Parent
button.MouseButton1Click:Connect(function(plr)
local hasPass = marketplace:UserOwnsGamePassAsync(plr.UserId, gamepassID)
if hasPass then
print("the user owns the gamepass")
else
marketplace:PromptGamePassPurchase(plr,gamepassID)
end
end)
Also, i have made else, so if i dont own the gamepass its propmt purchasing, so i shouldve deleted it from my inventory so it works but i have it thanks
local marketplace = game:GetService("MarketplaceService")
local gamepassID = 63421396
game.Players.PlayerAdded:Connect(function(plr)
local hasPass = marketplace:UserOwnsGamePassAsync(plr.UserId, gamepassID)
if hasPass then
--put effect here
end
end)