I would put the backpack connection code within that new back pack code to always ensure the new backpack is connected.
1 Like
either way, why does it works on a baseplate but not in MY game? like, what?
hey, it worked, weird error I never been through haha.
ended up doing this;
local BackpackCons = {}
local function ConnectBackpack()
for i,v in pairs(BackpackCons) do
v:Disconnect();
end;
BackpackCons[#BackpackCons + 1] = Player.Backpack.ChildRemoved:Connect(function(child)
local find = Player.Character:FindFirstChild(child.Name)
if (find == nil) then
for i,v in pairs(Backpack.Slots:GetChildren()) do
if (v:IsA("Frame")) then
if (v.TName.Text == child.Name) then
v.BackgroundTransparency = .7;
--v.Visible = false;
v.TName.Text = ''
end
end
end
end;
end)
BackpackCons[#BackpackCons + 1] = Player.Backpack.ChildAdded:Connect(function(child)
for i = 1,7 do
local slot = Backpack.Slots:FindFirstChild(i)
if slot then
if (#slot.TName.Text < 1) then
local continue = true
for i,v in pairs(Backpack.Slots:GetChildren()) do
if (v:IsA("Frame")) then
if (v.TName.Text == child.Name) then
continue = false;
end
end
end
if (continue == true) then
slot.TName.Text = child.Name;
--slot.Visible = true;
end
end
end
end
end)
end
ConnectBackpack()
Player.ChildAdded:Connect(function(child)
if child.Name == "Backpack" then
ConnectBackpack()
end
end)