Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I keep the same player from purchasing access when he joins?

Asked by 10 years ago

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:

01DataStore = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
02 
03 
04 
05game:GetService("MarketplaceService").ProcessReceipt = function(infoo)
06    local playerDPkey = infoo.PlayerId..":"..infoo.PurchaseId
07    if DataStore:GetAsync(playerDPkey) then
08    else
09        print(playerDPkey)
10        for i,v in pairs(game.Players:GetChildren()) do
11            if v.userId == infoo.PlayerId then
12 
13                if infoo.ProductId == 22453272 then
14                    if v.PlayerGui:FindFirstChild("GameGui") then
15                    v.PlayerGui.GameGui:Destroy()
View all 26 lines...

and here is the local script in the starterpack:

1local buyButton = game.Players.LocalPlayer.PlayerGui:WaitForChild("GameGui").Frame.TextButton
2local productId = 22453272
3buyButton.MouseButton1Click:connect(function()
4    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
5end)

. Can anyone help me on figuring out how to do this? Thanks for reading! TroytheDestroyer

1 answer

Log in to vote
0
Answered by
iLegitus 130
10 years ago

Eh,Your problem is the DevProduct itself, Developer Products are not suited for this. Try gamepasses. Difference : Gamepasses : Save purchase,(1 purchase time only) DevProdcuts : Non-Saving Purchase (Multiple time purchase)

0
Then again,Paid acess suits it aswell (But minimum is 25R$) iLegitus 130 — 10y
0
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. TroytheDestroyer 75 — 10y
0
Well,Thats still the same,Either its a t-shirt or a gamepass. (Just not implemented in a game). iLegitus 130 — 10y
Ad

Answer this question