If Player owns VIP gamepass they get 500 "points"

I’ve been reading over this article: https://developer.roblox.com/en-us/articles/Game-Passes-One-Time-Purchases

I couldn’t manage to figure out how to if the player owns the pass then it gives +500 Points then changes the value in my datastore to true to register that the player has already gotten the reward.

I know the error of why it’s not giving them points I just don’t know how to get around it as I’m a fairly new to scripting on here. It’s because I’m sending it through a script in ServerScriptService I was just wondering if I should fire an event through a LocalScript on purchase then it changes the values, and registers it.

I would just like to see if I could get any help or feedback on how I should go about doing this.

Thanks for reading and for any feedback you can give me.


You can use PromptGamePassPurchaseFinished to process any completed (or rejected) gamepass purchases. You should also process the ownership of this gamepass upon player joining to make sure players who buy it on the webpage also get their reward.
I wouldn’t use a LocalScript for any of this at all.

1 Like

Here is a script that you could use:

--Script Made By Theyoloman1920, 30 June 2020

local MarketPlaceService = game:GetService("MarketplaceService")

local GamepassID = --(your gamepass ID)
local Player = game.Players.LocalPlayer


if MarketPlaceService:UserOwnsGamePassAsync(Player.userId, GamepassID) then
      --give to the player the extra points (I guess you already have a point system, so you can add it here)

Please tell me if the script worked (note that you will have to make it fire once)

There is a problem with this

If it was for explaination then it’s Ok
But else there is a problem:

  • If its a ServerScript then it won’t run as

run only in Local Scripts

  • If its a LocalScript then it won’t replicate to others or server
1 Like

Hmm, I see, you are right. Thanks for the feedback!

1 Like

You would have to somehow store a Boolean of whether the player has received the VIP points.

When the player joins check if they have the gamepass, if they do, check the above value, if it’s false, award 500 points and save it as true.

Here’s an example you can look into.

local Players = game:GetService('Players')
local MP = game:GetService('MarketplaceService')

local Id = 10001499
local VIP_Amount = 500
local Default_Amount = 50

	local Stats = Instance.new('Configuration')
	Stats.Name = 'leaderstats'
	Stats.Parent = Player
	local Coins = Instance.new('IntValue')
	Coins.Name = 'Coins'
	Coins.Value = MP:UserOwnsGamePassAsync(Player.UserId, Id) and VIP_Amount or Default_Amount
	Coins.Parent = Stats

-- Give them 500 extra coins if they purchase the game pass ingame?
MP.PromptGamePassPurchaseFinished:Connect(function(Player, GamePassId, IsPurchased)
	if GamePassId == Id and IsPurchased then
		local Stats = Player:FindFirstChild('leaderstats')
		if Stats then
			local Coins = Stats.Coins
			Coins.Value += VIP_Amount

Figured this out last night, thanks for the support anyways forgot to add a player:WaitForChild()