Hello! And welcome to my first ever tutorial!! Today I am going to teach you about Gamepass info or otherwise known as Enum.InfoType.GamePass
.
There are 5 sections to this tutorial. (One for each MOST IMPORTANT property) down below you can open and close them!
1. Getting the price
How to get the price of a gamepass.
Getting the price of a gamepass is super simple! (I will also show you how to find out the USD price of the gamepass!)
The price of a gamepass is passed through a variable called: PriceInRobux
.
This variable hold the amount the gamepass costs in robux.
HOW TO GET
local mps = Game:GetService("MarketPlaceService")
local info = mps:GetProductInfo( -- id, --chosen info type)
local Price = info.PriceInRobux --right here!
-- if your print the "Price" variable, it will print the price of the gamepass!
EXCEPTIONS
there are reasons why this variable may be nill!!
-
The ID used in
MarketPlaceService:GetProductInfo(--This variable here!!, --infotype)
may not be correlated with a gamepass. - The gamepass may be banned, not for sale, or deleted. Therefore, there is no price to get.
HOW TO GET THE PRICE IN USD OF A GAMEPASS
we all know that the price in USD to buy 80 robux is 1 US dollar, and 400 robux is 5 US dollars. So,
we can create a simple proportion to solve this, 80x/y = 80/1. If you dont know how to solve proportions, I can make this easy for you. When you know your desired amount, divide by 80! I know this works because if I want to convert 100 robux to USD, dividing by 80 would get me 1.25 (USD), This is true because if thats the price for 100 robux, than you can multiply it by 4, getting: 100 x 4 = 1.25 x 4. Simplifying that, 400 robux = $5! (sorry if this explanation was rough!)
2. Getting the name
Getting the name of a gamepass is also easy
It is passed through a variable called Name
GETTING IT
local mps = Game:GetService("MarketPlaceService")
local info = mps:GetProductInfo( -- id, --chosen info type)
local Price = info.Name --right here!
this returns a string carrying the name of the gamepass
you can use this (for example) to see if a gamepass is titled with a certain keyword. (im not sure if you will ever need to do that) but now you know!
3. Getting the icon
getting the icon of the pass is also easy!
it is passed in a variable called IconImageAssetId
the only difference with this is that this variable holds an ID, not a preloaded decal.
to upload it (and get the image), you can follow these steps.
local Inf = --vars:GetProductInfo(--more vars)
local Imageicon = inf.IconImageAssetId
--then you can set this image variable as the value in the image property in a decal
local decal = game.Workspace.Decal
decal.Image = Imageicon
--right now this is just an ID, but roblox actually formats it for you to rbxassetid://123456789
If you were to send this image over to discord using HTTP service, it would not work because it’s NOT a url.
4. Getting the creator details
Getting the creator details is a bit of a harder topic, because there are a few more things to do.
a TABLE of values is passed through the creator variable. Creator
but I believe the most two important ones are the name, and the user ID.
the name passes, well, the name! ex. “Iloverobux123”
the ID passes a roblox UserID, which can take you to the persons profile, find out what number player the acc joined, fun stuff like that. (also will give you info abt the plr! like if they are banned or not from your game as an example. )
simply plug the Id into this URL
local link = https://www.roblox.com/users/ --PLACE ID HERE
ex. plugging in a valid ID would result in: hazem - Roblox a link like this (not that players could use it in roblox)
5. Checking for limited
To check if a gamepass is a limited one, all you have to do is call a variable named IsLimited
This variable is a bool, it’s either true or false. If it is true than the item is limited, otherwise, its not.
GETTING IT
local mps = Game:GetService("MarketPlaceService")
local info = mps:GetProductInfo( -- id, --chosen info type)
local Price = info.IsLimited --right here!
Thank you for reading this tutorial! I accept all feedback dont be afraid to say it! Thanks
- Did you like this tutorial?
0 voters
I am live responding to questions!