Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make it so you lose your bought items on death?

Hello, i found a working script for my shop gui but i have a slight problem, your bought item doesnt go away if you reset/die.

player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Money
price = 0--Price
tool = game.Lighting:findFirstChild("PPSH41")



function buy()
if money.Value >= price then
money.Value = money.Value - price
local a = tool:clone()
a.Parent = player.Backpack
local b = tool:clone()
b.Parent = player.StarterGear

end
end
script.Parent.MouseButton1Down:connect(buy)

1 answer

Simple, remove the part when it puts the tool into your starter gear.

player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Money
price = 0 --Price
tool = game.Lighting:findFirstChild("PPSH41")

function buy()
    if money.Value >= price then
        money.Value = money.Value - price
        local a = tool:clone()
        a.Parent = player.Backpack
    end
end

script.Parent.MouseClick:Connect(buy)

1 comment

0

I suggest learning a bit about the scripts you use and creating your own once you learn what everything means. Everyone starts from somewhere!

This discussion is preserved as it was. New answers, comments, and votes are closed.