Hello! To check out the new developer product feature, I decided to make this SurfaceGUI in my place where you can buy a product for 10 tickets, and it gives you a tool from Lightning. At first I tried making it using a normal GUI, but I gave up seeing I couldn't figure it out.
I got closer to reaching my goal when using the SurfaceGUI, though. Almost everything is ready; you can click the SurfaceGUI, and it'll show you the message to confirm the purchase. However, I can't make it give you the tool upon purchase, even though I know exactly where I have to edit the script. Code below:
-- setup local variables local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = "19182249" -- define function that will be called when purchase finished MarketplaceService.ProcessReceipt = function(receiptInfo) -- find the player based on the PlayerId in receiptInfo for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then -- check which product was purchased if receiptInfo.ProductId == productId then -- the part below is the where the tool giving line should be, instead of healing the player player.Character.Humanoid.Health = 100 -- more feedback for the player. game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = player.Name .. " has purchased a healing potion." end end end -- record the transaction in a Data Store local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId ds:IncrementAsync(playerProductKey, 1) -- tell ROBLOX that we have successfully handled the transaction return Enum.ProductPurchaseDecision.PurchaseGranted end
Right now, what the purchase does is set your health to 100. The tool I want to be given is called GoldenAWP. Could anyone help me? Thanks!
Please keep in mind I can't script at all.
Try changing the walkspeed code to
game.Lighting["Weapon"]:clone().Parent = player.BackPack
If you change it to:
game.Lighting["Weapon"]:clone().Parent = player.BackPack
Then you have to actually put the tool in Lighting.