So basically I'm creating three folders in Backpack and StarterGear: Swords, Magic, and Potions. But I want my tools to equip and unequip in my Backpack GUI. The only problem is that the equip works kinda works, but when you unequip it, it'll just go and stay inside the Backpack instead of inside of the "Swords" folder in the Backpack. And when you equip it again, it'll come back inside of the "Swords" folder.
Equip Button:
local equipped = script.Parent.Parent.Parent.HandlerS.Equipped
local selected = script.Parent.Parent.Parent.HandlerS.Selected
local location = script.Parent.Parent.Parent.HandlerS.Location
local player = game.Players.LocalPlayer
local character = player.Character
script.Parent.MouseButton1Click:connect(function()
if equipped.Value == nil or equipped.Value ~= selected.Value then
character.Humanoid:UnequipTools() -- Forces the player to unequip the tool that they equipped
if location.Value == player.Backpack:WaitForChild("Swords") then
character.Humanoid:EquipTool(selected.Value)
equipped.Value = selected.Value
script.Parent.Text = "Unequip"
end
else
character.Humanoid:UnequipTools()
equipped.Value = nil
script.Parent.Text = "Equip"
end
end)
