Unable to cast token to token

Hello DevForum members!

I am trying to make a script that will display the gamepass name and description. I used the plain :GetProductInfo but that showed a name and description for a decal, so I set the AssetType to Gamepass and it gave me an error Unable to cast token to token, I am struggling to find a fix for this, please help!

My Code:

local mps = game.MarketplaceService
local gamepass = game.MarketplaceService:GetProductInfo(17152081,Enum.AssetType.GamePass)

script.Parent.GamepassName.Text = gamepass.Name
script.Parent.Description.Text = gamepass.Description

Thanks,
xMas_Ier

Enum.InfoType.GamePass, you accidentally were getting the Enum for AssetType, but GetProductInfo only accepts Enums from InfoType

2 Likes

Whoops! Silly mistake. It works now, thanks for your help!

1 Like

Anytime! If you have anymore issues don’t be afraid to make anotehr post!

And haha, silly mistakes like those happen, so it’s okay!

1 Like