(Developer product) Need to fix a script

I need that when a player click a uibutton, he is going to be able to buy a product with his robux (developer product) by puchasing this the player that buy the product will get 100/100 of his life back
(ask for other information)

Here is a exemple of script I’ve use for an other game using developper product
(It kill all other player when purchase)

:arrow_down:The one inside serverscriptservice :arrow_down:

local mps = game:GetService("MarketplaceService")
local players = game:GetService("Players")


local function killAll(reciept)


	if(reciept.ProductId == 1268333555) then
		for i,v in pairs(game.Players:GetPlayers()) do
			if(v.UserId ~= reciept.PlayerId and v.Character and v.Character:FindFirstChild("Humanoid")) then
				v.Character:FindFirstChild("Humanoid").Health = 0
			end
		end

		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end



mps.ProcessReceipt = killAll

:arrow_down:The one inside the uibutton :arrow_down:

local mps = game:GetService("MarketplaceService")


script.Parent.MouseButton1Click:Connect(function()
	mps:PromptProductPurchase(game.Players.LocalPlayer, 1268333555)
end)

Can you explain whats wrong? Nobody can help you if they don’t know whats wrong

I think you need to add some of these “()” at the end of the server script, like this.
mps.ProcessReceipt = killAll()

Is the prompt not showing up? Or is it just not killing anybody?

That’s not how it works.

Sorry, but i’ve leave all the information at the top
Those script ar just exemple

This should fix it, client script is fine,

Server Script

local MarketplaceService = game:GetService("MarketplaceService")

local function processReceipt(receiptInfo)
    local productId = receiptInfo.ProductId
    local playerId = receiptInfo.PlayerId

    if productId == 1268333555 then
        local player = game:GetService("Players"):GetPlayerByUserId(playerId)
        if player and player.Character and player.Character:FindFirstChild("Humanoid") then
            player.Character.Humanoid.Health = 100
        end
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end

MarketplaceService.ProcessReceipt = processReceipt

Please reply if this fixed your solution

Yep, probleme solve

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.