I am currently working on an obby where the player is invisible. But I have 1 problem. I want to make a developer product that you can buy so you turn visible for 10 seconds. I've watched a lot of tutorials and forum posts but none of those seem to work. Can anyone help me out?
COMMUNITY QUESTION
How do I make someone visible with a developer product?
2 answers
I have no idea if this works cuz I'm broke
local developerProductsPage = game:GetService("MarketplaceService"):GetDeveloperProductsAsync():GetCurrentPage()
local DeveloperProducts = getmetatable(newproxy(true))
for _, developerProduct in pairs(developerProductsPage) do
table.insert(DeveloperProducts,developerProduct.DeveloperProductId)
end
local function GetDescendantTableClass(Object,Class)
local tab = getmetatable(newproxy(true))
for _,v in next,Object:GetDescendants() do
if v:IsA(Class) then
table.insert(tab,v)
end
end
return tab
end
game.Players.PlayerAdded:Connect(function(Player)
if Player then
game:GetService("MarketplaceService").PromptPurchaseFinished:Connect(function(P,ID,PURCHASED)
if P == Player and DeveloperProducts[ID] and PURCHASED == true then
for _,part in next,GetDescendantTableClass(Player.Character,"BasePart") do
if part.Name ~= "HumanoidRootPart" then
part.Transparency = 1
end
end
wait(10)
for _,part in next,GetDescendantTableClass(Player.Character,"BasePart") do
if part.Name ~= "HumanoidRootPart" then
part.Transparency = 0
end
end
end
end)
end
end)
I think that MarketplaceService is the best option for this. Here is a block of code how to do that:
local MarketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if MarketplaceService:PlayerOwnsAsset(--your id--) then
-- what you want to do if the player has your gamepass --
end
end)
Also, a person commented that it was wrong, so I'm revamping it: Its Probably MarketplaceService, but I don't use gamepassservice so just watch a tutorial because idk
2 comments
0
You're doing it wrong he was when someone purchases it not when someone already purchased it unless you're making a gamepass script
0
Ok Lemme just edit the post
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Where do I put my developer product ID?
I made it so it gets all developer products, do you want me to edit it?