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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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)
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! tightanfall 110 — 3y
Ad

Answer this question