@ii_inforcelaw
So you are getting the error because the “player” variable is not specified, youll need the UserId of the player to prompt the purchase them,
For Example:
@ii_inforcelaw
So i have been testing and here is what i came up with:
local gamepassId = "your Id here"
local Plr = game:GetService("Players").LocalPlayer.UserId
script.Parent.Activated:Connect(function()
game:GetService("MarketplaceService"):PromptPurchase(Plr, gamepassId)
end)
Not exactly sure if it will work, but i think it does
local Player = game:GetService("Players").LocalPlayer
local GamepassId = "Your Gamepass Id"
script.Parent.Activated:Connect(function()
game:GetService("MarketplaceService"):PromptPurchase(Player, GamepassId)
end)
The Error was that youre not supposed to have UserId, just LocalPlayer. That explains the casting error.
@ii_inforcelaw you had it right the first time, it was just the variable “player” didnt connect to the player, nor was it specified to the player. Sorry for my stupidity.