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)
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.
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)
game.Players.LocalPlayer:Died:connect(function() (Clone the tool and put it in the backpack here) end)
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)