Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[This script goes inside of a TextBox which should be inside of a ScreenGui]]
- productId = 25299632 -- Replace 123123123 with the id of your developer product.
- local DataStore = game:GetService("DataStoreService"):GetDataStore("clams")
- local MarketplaceService = Game:GetService("MarketplaceService")
- function UsernameFromID(ID)
- if type(ID) ~= "number" then
- return
- end
- local sets = game:service("InsertService"):GetUserSets(ID)
- for k, v in next, sets do
- if v.Name == "My Models" then
- return v.CreatorName
- end
- end
- end
- function giveRewards(player)
- local plyr = script.Parent.Parent.Parent.Parent
- plyr:WaitForChild("Clams")
- plyr.Clams.Value = plyr.Clams.Value + 50
- plyr.PlayerGui.AllahAkbar.Allah.Text = tostring(plyr.Clams.Value)
- local key = "user_" .. plyr.userId
- DataStore:SetAsync(key, plyr.Clams.Value)
- return Enum.ProductPurcaseDecision.PurchaseGranted
- end
- MarketplaceService.ProcessReceipt = function(receiptInfo)
- giveRewards(UsernameFromID(receiptInfo.PlayerId))
- end
- script.Parent.MouseButton1Down:connect(function()
- Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement