I want to make it so if a player has a gamepass, they'll get one gem (Called 'Gems' in leaderstats) every time they enter the game. How do you do this?
PlayerOwnsAsset, when used in LocalScripts, will return live results from the ROBLOX website. Therefore, no matter when he purchases the item, it will return the most recently updated value.
local MarketplaceService = game:GetService('MarketplaceService') local ProductId = 12345 game.Players.PlayerAdded:connect(function (player) if MarketplaceService:PlayerOwnsAsset(player, ProductId) then --create leaderstat local stat = Instance.new('NumberValue') -- parent to default leaderstats folder/container/model stat.Parent = player['path to leaderstats folder'] end end)
Closed as Not Constructive by evaera
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?