-
What do you want to achieve? I want it so you have to have to have a tool in your backpack equipped, you can swap between tools but you cannot unequip it. Its very important for them to be swappable.
-
What is the issue? I dont know how to do it.
-
What solutions have you tried so far? I looked on the developer hub and asked some of my friend. The only thing I found is a solution but it would make it so I cant swap my items.
What do you mean by swap items do you have your own inventory system or are you using roblox’s default?
I have a custom backpack system that just hides the inventory, that all it does.
Yeah you gonna have to make your own inventory system then, if you want special features because since you hide the roblox inventory you cant use it too switch weapons/tools
It only hides the backpack, you can still equip the items in it it just doesnt show the gui. I dont know how to make my own inventory system.
Wait so what exactly is your main goal here because up there its kinda of confusing what your trying to achieve
I want it so you always have to have a tool in your backpack equipped. You can swap it out with other tools in the backpack.
How do you expect to be able to swap it out when there is no gui?
pressing 1 or 2
30charssssssssss
Well does pressing 1 or 2 work? If it does then you just fixed your problem
Is there a script that equips a item in your inventory? That could be enough. I could see if the player presses 1 or 2 again and then I could just make it so it equips it.
I really just highly suggest you make your own inventory system because youll have more control over the equipping and everything else
I dont know how to do that.
30charssssssssssssssssss
I think you can loop through tools, and connect the Unequipped event, and when the player unequips the tool, you can force the tool to be equipped by parenting it to the player’s character.
for index, tool in pairs (player.Backpack:GetChildren()) do
if tool:IsA("Tool") then
tool.Unequipped:Connect(function()
tool.Parent = player.Character
end)
end
end
local player = game.Players.LocalPlayer
for index, tool in pairs (player.Backpack:GetChildren()) do
if tool:IsA("M4A1") then
tool.Unequipped:Connect(function()
tool.Parent = player.Character
end)
end
end
so this will work?
You cant change whats inside of the IsA function with the name of the tool your going to have to do,
for index, tool in pairs (player.Backpack:GetChildren()) do
if tool:IsA("Tool") and tool.Name == "M4A1" then
tool.Unequipped:Connect(function()
tool.Parent = player.Character
end)
end
end
i tried doing this:
local player = game.Players.LocalPlayer
for index, tool in pairs (player.Backpack:GetChildren()) do
if tool:IsA("Tool") and tool.Name == "M4A1 then
tool.Unequipped:Connect(function()
tool.Parent = player.Character
end)
end
end
it doesnt work, i put it inside startercharacterscripts
I forgot the quote at the end of the gun name, I fixed the code above
@PlayingRobIoxStudio edited their reply. Add the extra " after M4A1.
Still doesnt work…
30characters