Hi. I wanna make a gamepass prompt but it keeps saying attempted to nil with UserId
What do I do?
local Items = {
x2Dice = {
Name = "x2 Dice",
Cost = 500
},
Custom = {
Name = "the Custom Skin",
Cost = 200
}
}
workspace.Server.Purchase.OnServerInvoke = function(p, item)
local i = Items[item]
local g = 11592650
local MarketPlaceService = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer
local Haspass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, g)
if not i then
warn("Item "..item.." doesn't exist")
return {
{TX = {"Error - you have not been charged."}}
}
end
if item == "Messor" and p.Data.Hats:FindFirstChild("Messor") then
return {
{TX = {"You already have the Messor."}}
}
elseif item == "Debug" then
return {
{TX = {"This item has been discontinued and may be brought back at a later date."}}
}
end
if Haspass then
return {
{TX = {"You've already purchased ","TXEFX:TextColor3:#FF0000",i.Name.."."}}
}
else
MarketPlaceService:PromptGamePassPurchase(Player, g)
end
return {
{TX = {"You have purchased ","TXEFX:TextColor3:#FF0000",i.Name.."!"}}
}
end
local g = 11592650
local MarketPlaceService = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer
local Haspass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserID, g)
if Haspass then
print("Has the pass.")
end
thats all of the script i think