Make Humanoid:EquipTool work on any Tool regardless of current parent

Humanoid:EquipTool(tool) only works on Tools that are already in the Workspace. It would probably be a very minor change to make it work for any Tool, regardless of parent. The main use case here is programmatically cloning tools from ServerStorage or someplace directly into the player’s character.

https://developer.roblox.com/en-us/api-reference/function/Humanoid/EquipTool

If you are trying to create item spawners in your game, you might have some code that looks like this:

As a developer, you’d really like to avoid line 19 (currently necessary).

I’m not sure if there is a race condition here where I add the Tool to the Workspace and there happens to be a character standing there. Do they get the tool instead? I don’t want the Tool to exist in the Workspace until it’s in the character’s hand, as one atomic operation.

17 Likes