Hello! I want my gamepass to work in my game but you buy it in the lobby, and teleport to the game. I came here as nothing is helping, and I’m not sure how to make the item you buy appear in the game you get teleported into to. Thank you!
1 Like
Just do the same as always. The gamepass doesn’t have to be under that game for it to work. Simply do the same as usual with the gamepass id and it’ll work fine.
I don’t know how lol I made it let you buy the gamepass but how to make it know you have the gamepass?
local gamepassId = 0 -- Replace with the gamepass Id of choice.
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassId) then
-- gamepass bonuses
else
return -- no bonuses as player does not own gamepass
end
1 Like
For player, it doesn’t have any significance as in it doesn’t have a local player etc?
He meant for it to be inside of a playeradded function.
local gamepassId = 0 -- Replace with the gamepass Id of choice.
game.Players.PlayerAdded:Connect(function(player
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassId) then
-- gamepass bonuses
else
return -- no bonuses as player does not own gamepass
end
end)
Local or normal? And where should I put this script?
a normal script and in serverscriptservice.