Using EquipTool() on a part outside of Backpack causing the tool handle to break?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I’m attempting to set up a system of storing the player’s tools in 2 separate folders (for backpack and hotbar) instead of the default backpack, so that I have more control over the order of items and can save the player’s preferred item positions via datastores in the future. Currently, I have the folders set to the localPlayer, the same spot as the normal backpack. My hotbar GUI script can then be changed to pull items from these folders instead of the default backpack, and it can function identically on the frontend but (hopefully) allow for more flexibility when it comes to position saving.

  1. What is the issue? Include screenshots / videos if possible!

Attempting to call humanoid:EquipTool(tool) (a function that previously had no problems when I was using the base backpack) with the tools position being in the new backpack or hotbar folder will cause the part to not attach to the player’s arm, acting as if it has no handle and staying at its default position.

attempting to use EquipTool when the backpack is set to player.Backpack:
RobloxStudioBeta_J26b09b9TJ

attempting to use EquipTool when the backpack is set to player:WaitForChild(player.name . . “Backpack”) (the name of the custom backpack folder):
RobloxStudioBeta_bgy1CceVLf

Both screenshots were done on the exact same tool, with no part or script edits.
I may be misunderstanding where in the file structure the player can and cannot equip items from, but if it works with the localplayer’s backpack, shouldn’t it also be able to pull things from other locations in the localplayer?

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried moving the folders onto the actual playermodel, which causes problems since the parts are now in workspace and will have gravity affect them, causing them to fall into the void.

I’ve taken a look at potential solutions on the dev forum, but either I can’t find the right keywords to search for a solution, or this specific problem hasn’t been answered properly.

(I can provide more info if you need. I’ve never made a post on here before so I’m not sure how much context I need to give.)

1 Like

Yeah that’s weird, it seems like with your custom backpack folder isn’t automatically welding the tool to your hand and it falls into the void due it not having a weld.

1 Like

Well, based on all this it seems to me that Humanoid::EquipTool is designed to work only with the default backpack. Have you tried manually parenting the tool to the character to see if Roblox automatically registers that as a held tool?

1 Like

RobloxStudioBeta_LFEijG03hn
seems like it just does the same thing. It detects the player is “holding” the tool but it doesn’t actually weld the tool to the player’s hand.

EDIT: it appears changing the tool’s position to backpack before moving the tool to the player counts as equipping it. I’ll try to implement it in a bit, but it’s strange that the part will only weld properly if it’s coming from the player’s backpack.

1 Like

Edit 2: so doing this only actually attaches the weld to the player’s hand, but makes is so that the tool’s scripts all stop working so the tool is basically useless. I feel like there must be a better way to accomplish this but I don’t know how.

1 Like

What do you mean the scripts stop working, can you show an screenshot?

1 Like

RobloxStudioBeta_U2YxYFVptM
as an example, this ‘fusion coil’ tool is supposed to make the player able to walk faster and jump higher. It uses a localscript with a function that connects when the tool is equipped to add ‘GravityCoilScript’ and ‘SpeedBoostScript’ into the player model, which then both have their own equipped functions that are supposed to give these effects to the player. The localscript’s equipped() function is connected, but the created scripts do not appear to connect, thus leading to the tool being welded to the player’s arm and the scripts being created, but no changes to walkspeed or gravity are applied.

1 Like

Can you provide a image of your custom backpack script?

it’s more or less split up into a couple of different parts. This normal script in serverscriptservice sets up the two folders when the player joins and moves the starterpack items into it when the player spawns:

local function migrateStarterPack(char, player)
	for _, child in pairs(player.Backpack:GetChildren()) do

		if child:IsA("Tool") then
			
			child.Parent = player:FindFirstChild(player.name .. "Backpack")

		end

	end
end

Players.PlayerAdded:Connect(function(player)
	local backpack = Instance.new("Folder"):Clone()
	backpack.Name = player.name .. "Backpack"
	backpack.Parent = player

	local hotbar = Instance.new("Folder"):Clone()
	hotbar.Name = player.name .. "Hotbar"
	hotbar.Parent = player
	
	player.CharacterAdded:Connect(function(char)
		migrateStarterPack(char, player)
	end)
	
end)

And this function inside of the hotbar GUI local script is what is used to equip the tools when the player presses a number or clicks on one of the icons (it moves it to the backpack first because otherwise the part doesn’t even attach to the player’s hand):

function handleEquip(tool)
	if tool then
		if tool.Parent ~= char then
			tool.Parent = player.Backpack
			hum:EquipTool(tool)
			
		else
			hum:UnequipTools()
		end
	end
end

No idea honestly, but i would say to you to make the 2 folders inside the Player.Backpack and see if it works lol

update, I just decided to rework the whole system using another guide as a base. I still need to sort some things out but it seems like a much cleaner solution overall.

1 Like

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