Hello,
Looking at a previous problem from a different angle. Basically, after a player purchases a weapon, it appears in the StarterGear and Backpack, but once the player dies and re-spawns, the weapon is still in the StarterGear, but is no longer accessible via the Backpack.
Below is my Purchase script within my ShopGui which purchases the item and adds it to the StarterGear and BackPack:
local plr = game.Players.LocalPlayer
local replicatedstorage = game:GetService('ReplicatedStorage')
local amount = 30
local points = plr.leaderstats.Points
script.Parent.MouseButton1Click:connect(function()
if plr.Backpack:FindFirstChild('GravityCoil') or plr.StarterGear:FindFirstChild('GravityCoil') or game.Workspace[plr.Name]:FindFirstChild('GravityCoil')then -- Change the name of the items.
script.Parent.Parent.TextLabel.Text = 'You have already bought this item!'
wait(3)
script.Parent.Parent.TextLabel.Text = 'Welcome to the shop'
else
if plr.leaderstats.Points.Value >= amount then
replicatedstorage.GravityCoil:Clone().Parent = plr.Backpack -- Item added to Backpack.
replicatedstorage.GravityCoil:Clone().Parent = plr.StarterGear -- Item added to StarterGear.
plr.leaderstats.Points.Value = plr.leaderstats.Points.Value - amount
else
local pointsrequired = amount - points.Value
script.Parent.Parent.TextLabel.Text = 'You need '..pointsrequired..' more Points to buy this item!'
wait(3)
script.Parent.Parent.TextLabel.Text = 'Welcome to the shop'
end
end
end)
Now, inside my main script right after the random map process happens, I have the following code that adds a Sword to the player. I'm wondering if this code is interfering with the code above and preventing items from returning to a player's backpack after the re-spawn?
My main script is essentially the following:
-- Variables defined
-- Sets up Round
-- Teleport players to the map
-- Adds basic sword to player
local sword = game.ReplicatedStorage.Sword
local newsword = sword:Clone()
newsword.Parent = player.Backpack
end
end
end
-- End of Round/Teleport survivors back to the lobby
-- Rinse/Repeat
I've been given the following script to place inside Workspace, but it doesn't solve the problem of the weapons disappearing from the backpack on re-spawn:
local wm = Instance.new("Model")
wm.Name = "Weaps"
function give(weap, player) --add a weap to a player's weaps
--return if they allready have a copy
for _, w in ipairs(player.Weaps:GetChildren()) do
if w.Name == weap.Name then return end
end
--return if the weaps is a startpack one
for _, w in ipairs(game.StarterPack:GetChildren()) do
if w.Name == weap.Name then return end
end
--add it to thier weaps
weap:clone().Parent = player.Weaps
end
game.Players.ChildAdded:connect(function(p)
wm:clone().Parent = p
wait()
p.Character.ChildAdded:connect(function(wep)
if wep.className == "Tool" then
give(wep, p)
end
end)
p.Changed:connect(function(pr)
if pr == "Character" then
for _, w in ipairs(p.Weaps:GetChildren()) do
w:clone().Parent = p.Backpack
end
p.Character.ChildAdded:connect(function(wep)
if wep.className == "Tool" then
give(wep, p)
end
end)
end
end)
p.Backpack.ChildAdded:connect(function(h)
if h.className == "HopperBin" then
give(h, p)
end
end)
end)
I know I've got to be overlooking or mistyping something very simple, I'm all ears/eyes for any solution here. x_x Thank you!

2 comments
isn't the use of HopperBins deprecated? Maybe this could be causing your disappearing items
Maybe, but even without that script with the HopperBins, my items were still disappearing.