im trying to make it so that you pick up a item it will go into your backpack but when you pickup a item your character equips it but i don't want that so how do you stop that heres the script for picking up items
player.Backpack.ChildAdded:connect(function(instance)
local name=instance.Name
if name==game.Lighting.E:GetChildren()[1].Name or name==game.Lighting.Q:GetChildren()[1].Name or name==game.Lighting.R:GetChildren()[1].Name or name==game.Lighting.F:GetChildren()[1].Name or name==game.Lighting.G:GetChildren()[1].Name then
print(instance.Name .. " added to the backpack by item Clone")
else
print(instance.Name .. " added to the backpack by item pickup")
end
end)
thats part of my script i make it so that if you pickup a item and it goes into your backpack it fires but it equips it before going into your backpack heres full script
local player=game.Players.LocalPlayer
local y=1
local l=1
local c=1
local tools={
E=game.Lighting.E:GetChildren()[1]:Clone();
Q=game.Lighting.Q:GetChildren()[1]:Clone();
R=game.Lighting.R:GetChildren()[1]:Clone();
F=game.Lighting.F:GetChildren()[1]:Clone();
G=game.Lighting.G:GetChildren()[1]:Clone();
}
local tool={
game.Lighting.E:GetChildren()[1];
game.Lighting.Q:GetChildren()[1];
game.Lighting.R:GetChildren()[1];
game.Lighting.F:GetChildren()[1];
game.Lighting.G:GetChildren()[1];
}
game:GetService("UserInputService").InputBegan:connect(function(inputObject)
if inputObject.KeyCode.Name=="Slash"then
while l == 1 do
y=3
c=3
player.Character.Humanoid:UnequipTools()
player.PlayerGui.Invintory.Frame.Visible = false
wait()
end
c=1
y=1
elseif inputObject.KeyCode.Name=="Return" then
l = 2
wait()
l = 1
else
local tool=tools[inputObject.KeyCode.Name]
if tool then
if y==1 then
player.Character.Humanoid:EquipTool(tool)
y=2
if inputObject.KeyCode.Name == "E" then
player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(13/255,120/255,177/255)
elseif inputObject.KeyCode.Name == "Q" then
player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(13/255,120/255,177/255)
elseif inputObject.KeyCode.Name == "R" then
player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(13/255,120/255,177/255)
elseif inputObject.KeyCode.Name == "F" then
player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(13/255,120/255,177/255)
elseif inputObject.KeyCode.Name == "G" then
player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(13/255,120/255,177/255)
end
elseif y==2 then
player.Character.Humanoid:UnequipTools()
if inputObject.KeyCode.Name == "E" then
player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255)
elseif inputObject.KeyCode.Name == "Q" then
player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255)
elseif inputObject.KeyCode.Name == "R" then
player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255)
elseif inputObject.KeyCode.Name == "F" then
player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255)
elseif inputObject.KeyCode.Name == "G" then
player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255)
player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255)
end
y=1
end
end
end
end)
game:GetService("UserInputService").InputBegan:connect(function(inputObject)
if inputObject.KeyCode.Name == "C" then
if c == 1 then
player.PlayerGui.Invintory.Frame.Visible = true
c=2
elseif c == 2 then
player.PlayerGui.Invintory.Frame.Visible = false
c=1
end
end
end)
player.Backpack.ChildAdded:connect(function(instance)
local name=instance.Name
if name==game.Lighting.E:GetChildren()[1].Name or name==game.Lighting.Q:GetChildren()[1].Name or name==game.Lighting.R:GetChildren()[1].Name or name==game.Lighting.F:GetChildren()[1].Name or name==game.Lighting.G:GetChildren()[1].Name then
print(instance.Name .. " added to the backpack by item Clone")
else
print(instance.Name .. " added to the backpack by item pickup")
end
end)
while true do
player.PlayerGui.InventoryGui.Frame.Frame.E.NameE.Text = game.Lighting.E:GetChildren()[1].Name
player.PlayerGui.InventoryGui.Frame.Frame.F.NameF.Text = game.Lighting.F:GetChildren()[1].Name
player.PlayerGui.InventoryGui.Frame.Frame.G.NameG.Text = game.Lighting.G:GetChildren()[1].Name
player.PlayerGui.InventoryGui.Frame.Frame.Q.NameQ.Text = game.Lighting.Q:GetChildren()[1].Name
player.PlayerGui.InventoryGui.Frame.Frame.R.NameR.Text = game.Lighting.R:GetChildren()[1].Name
wait()
end

2 comments
it didnt work
All that tells me is you did it wrong. Try doing it right.