I am making a testing place, and set it to BC only. One NBC complained that he wanted it to be free to play. So I looked through the free models to find a developer product base.(After making my product in my game.)And I found a script in the workspace with the localscript in starterpack. I have ran into a problem I can not seem to fix. If a player joins, he is not able to play(since a GUI covers his screen)the game until he buys the developer product for 5 robux. Once he buys it, the Gui vanishes and he is able to play. My problem is, if he rejoins again, he has to re-pay. I want it to be a 1 time payment. Here is the script in the Workspace:
DataStore = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
game:GetService("MarketplaceService").ProcessReceipt = function(infoo)
local playerDPkey = infoo.PlayerId..":"..infoo.PurchaseId
if DataStore:GetAsync(playerDPkey) then
else
print(playerDPkey)
for i,v in pairs(game.Players:GetChildren()) do
if v.userId == infoo.PlayerId then
if infoo.ProductId == 22453272 then
if v.PlayerGui:FindFirstChild("GameGui") then
v.PlayerGui.GameGui:Destroy()
elseif v.userId ~= infoo.PlayerId then
v:Kick()
end
end
end
end
DataStore:SetAsync(playerDPkey, true)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
and here is the local script in the starterpack:
local buyButton = game.Players.LocalPlayer.PlayerGui:WaitForChild("GameGui").Frame.TextButton
local productId = 22453272
buyButton.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
. Can anyone help me on figuring out how to do this? Thanks for reading! TroytheDestroyer

3 comments
Then again,Paid acess suits it aswell (But minimum is 25R$)
I know, but if you go to roblox code school and teleport to the asylum, it prompts you to buy a product to access the game. After you buy it, you can rejoin and still have access.
Well,Thats still the same,Either its a t-shirt or a gamepass. (Just not implemented in a game).