So, I've made my own ToolBar Gui, where the player can select either a sword, hatchet or open their bag. The only problem is, when selecting a sword then say a hatchet, they have to press the hatchet button twice to select it. Is there anyway I could fix this code in each of the buttons to make the selection instant and in one press.
Because as you can see, the player can press the button again to deselect the tool and that seems to be the problem.
Thanks in advance.
local StarterGui = game:GetService('StarterGui') StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) enabled = true; sword = game.Players.LocalPlayer.Backpack["ClassicSword"] script.Parent.MouseButton1Down:connect(function() if enabled == false then game.Players.LocalPlayer.Character.Humanoid:UnequipTools() script.Parent.Image = "rbxassetid://424870026" print("Deselected") wait(0.2) enabled = true; end end) script.Parent.MouseButton1Down:connect(function() if enabled == true then game.Players.LocalPlayer.Character.Humanoid:EquipTool(sword) script.Parent.Image = "rbxassetid://424870066" if game.Players.LocalPlayer.leaderstats1.EquippedAxe.Value == 1 then script.Parent.Parent.AxeSlot.Image = "rbxassetid://423840627" end if game.Players.LocalPlayer.leaderstats1.EquippedAxe.Value == 100 then script.Parent.Parent.AxeSlot.Image = "rbxassetid://423907054" end print("Selected") wait(0.2) enabled = false; end end)