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

[Unsolved]Problem with Developer Product?

Asked by 10 years ago

I got the script Working; But when ever the Player who** bought the weapon dies he/she loses the weapon they bought from Dev Products**. So I want to know how can I give the Player the weapons so he/she won't lose there weapons if they die.

local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
deb = 0


script.Parent.MouseButton1Click:connect(function()
local marketId = 21055724
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
local c = game.Lighting.DualIllumina:Clone()
    c.Parent = plr.Backpack
wait(1)
deb = 0
end
end
end
end)

4 answers

Log in to vote
0
Answered by 10 years ago

Clone the tool twice so that one of the tools is in the Backpack and the other one is in the StarterGear. The reason you put one of the tools in StarterGear is that every time you die, StarterGear clones it's children to the Backpack.

0
Spongocardo do you mean like this(Coding Down below) faruque7722 5 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Spongocardo do you mean like this because I tried this a it doesn't seem to work :L but have you got any other solutions that I could try?

local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
deb = 0


script.Parent.MouseButton1Click:connect(function()
local marketId = 21055724
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
local c = game.Lighting.DualIllumina:Clone()
    c.Parent = plr.Backpack
local b = game.Lighting.DualIllumina:Clone()
    b.Parent = plr.StarterPack

wait(1)
deb = 0
end
end
end
end)
0
Change plr.StarterPack on line 16 to plr.StarterGear. StarterGear is inside the player, StarterPack is a service in the game. If this helps, please accept my answer. Spongocardo 1991 — 10y
0
I'll try it and if it works I'll accept your answer. faruque7722 5 — 10y
0
Thank you it works and here. faruque7722 5 — 10y
Log in to vote
0
Answered by 10 years ago
game.Players.LocalPlayer:Died:connect(function()
(Clone the tool and put it in the backpack here)
end)
0
Sinblade Thanks for the help but Spongocardo sorted it out for me :) faruque7722 5 — 10y
Log in to vote
0
Answered by 10 years ago

You can try something like this. I believe CharacterAdded is fired every time someone spawns. I did not test this script, so you may need to debug some things. Like the link to the player and his backpack. Good luck!

local link = game:GetService("MarketplaceService")
deb = 0

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(character)
        local marketId = 21055724
        link:PromptProductPurchase(plr,marketId)
        link.ProcessReceipt = function(receiptInfo)
            if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
                if deb == 0 then
                    deb = 1
                    local c = game.Lighting.DualIllumina:Clone()
                    c.Parent = plr.Backpack
                    wait(1)
                    deb = 0
                end
            end
        end
    end)
end)
0
That won't work because he wants it so that you click a button in a GUI to buy the tool. See my answer. Spongocardo 1991 — 10y

Answer this question