So I have this script inside of StarterGui and i want it to make the weapon go in your backpack when you click the equip button. When you click it you do get the weapon, but when you die you lose it. Why is this and could anyone help me how to make it so that the weapon stays in your backpack even when you die?
--Note: in the script only the lines where it clones the weapon are really important I think.
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack.Primary.Value then
script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack.Primary.Value = false
local CloneGalil = game.ServerStorage["Galil AR"]:clone()
CloneGalil.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack
script.Parent.Parent.Parent.Dummy.Primary.Weapon.Weapon.Visible = true
script.Parent.Text = "Weapon Equipped"
wait(1)
script.Parent.Text = "Equip"
script.Parent.Visible = false
else
script.Parent.BackgroundColor3 = Color3.new(1,0,0)
script.Parent.Parent.Parent.Parent.PrimaryAlreadyEquipped.Visible = true
wait(1)
script.Parent.BackgroundColor3 = Color3.new(0,1,0)
script.Parent.Parent.Parent.Parent.PrimaryAlreadyEquipped.Visible = false
script.Parent.Text = "Equip"
script.Parent.Visible = false
end
end)

1 comment
Put the wepon in starterpack if you want it to stay