How Do I Make A Script That Allows The Player To Equip Their Weapon With E Without The Weapon Appearing In Backpack

Hello Fellow Developers!

I’ve been having a bit of trouble figuring out on what to do to let a player equip their weapon using the button “E” without the weapon taking up any space in the 0-9 backpack slots, similar to the system used in the game TYPE://SOUL. Anyone got any ideas on what I should do?

Don’t make it a tool and use a custom hand-welding script.

1 Like

If I get what you’re saying, you can use this method.

  1. Create a Local Script in StarterGui or places where they will run, and disable the Backpack GUI like this:
    game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

  2. Create your tool and put it in the starterpack or backpack of the player. (You won’t see it appear on your screen though, which means clicking 0-9 won’t do anything.) Then, in the local script where you want to equip your specific tool, use UserInputService to detect Button Press (E) as shown:

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local toolName = "Tool" -- Replace with the name of your tool
local ToolForEquipping = player.Backpack:FindFirstChild(toolName) --This basically checks to see if it's in your backpack or not.

UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		if ToolForEquipping then
			if ToolForEquipping.Parent == player.Backpack then
				-- Equip the tool
				player.Character.Humanoid:EquipTool(ToolForEquipping)
				elseif ToolForEquipping.Parent == player.Character then
				-- Unequip the tool
				player.Character.Humanoid:UnequipTools()
			end
		end
	end
end)

Let me know if this is what you meant or not. :slight_smile:

Ty this helped alot! One question though, will I still be able to make a custom backpack GUI so players can use sword skills and abilities?

Yep! Definitely. Everything will always be in the backpack folder, so you can just look for the tools there, using something like:
local tool = game.Players.LocalPlayer.Backpack:WaitForChild("ToolName")
(That is if you place the tools there. This means it will be just like if you had the toolbar 0-9 GUI, but now you don’t. So work with it in your head as if it’s invisible if you get what I mean.)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.