Why isn't :EquipTool() working properly with costumes?

I’m using :EquipTool() to equip a tool to a player when they join my game. This works fine until I try using a costume such as the Robloxian 2.0 which causes my script to semi-break. When I try using :EquipTool() with a costume, it equips the tool but it breaks the functionality of the tool (it doesn’t execute any code).

Here is the code I’m using to equip the tool to the player:

local tools = game.ReplicatedStorage:WaitForChild("Tools")
		local tool = tools:WaitForChild("SwordRegion"):Clone()
		tool.Parent = tools
		local humanoid = character:WaitForChild("Humanoid")

The code I’m using for my tool is fine because my tool works if you just equip it from the backpack by pressing a number key.

I think you need to parent it to the workspace or something along those lines.

Try parenting the tool to the player’s backpack before using the humanoid:EquipTool() function.

using this code to parent the tool to the workspace still reproduces the same issue

		local tool = tools:WaitForChild("SwordRegion"):Clone()
		tool.Parent = workspace
		local humanoid = character:WaitForChild("Humanoid")
1 Like

the same issue still persists even after parenting the tool to the backpack, this is the code i used:

		local tool = tools:WaitForChild("SwordRegion"):Clone()
		tool.Parent = player:WaitForChild("Backpack")
		local humanoid = character:WaitForChild("Humanoid")
1 Like

The issue is your tool’s code rather than either the EquipTool function or the code you posted. Your code completely fine, any other changes to it wouldn’t change the issue and would in fact, in hindsight, make the situation worse by completing unnecessary operations.

Are you able to post the tool’s code instead? You say it’s fine when equipped normally via number keys but that doesn’t mean it may not contain the issue.

This is a snippet of the code from my sword, I don’t want to show all of my sword’s code (so people can’t steal it) but this is basically just what the Equipped event does in my sword.

local tweenService = game:GetService("TweenService")

local runService = game:GetService("RunService")

local moduleScripts = game.ReplicatedStorage:WaitForChild("ModuleScripts")

local remoteEvents = game.ReplicatedStorage:WaitForChild("RemoteEvents")

local damageEvent = remoteEvents:WaitForChild("SwordDamageEvent")

local swordModule = require(moduleScripts:WaitForChild("SwordModule"))

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local humanoid = character:WaitForChild("Humanoid")

local sounds = game.ReplicatedStorage:WaitForChild("Sounds")

local rotatedRegion3 = require(moduleScripts:WaitForChild("RotatedRegion3"))

local damageValues = require(moduleScripts:WaitForChild("SwordDamageValues"))

local slashSound = sounds:WaitForChild("SlashSound")

local hitSound = sounds:WaitForChild("HitSound")

local tool = script.Parent

local handle = tool:WaitForChild("Handle")

local animations = game.ReplicatedStorage:WaitForChild("Animations")

local mouseDown = false

local swordEquipTrack = animations:WaitForChild("SwordEquip")

local swordIdleTrack = animations:WaitForChild("SwordIdle")

local swordSlash1Track = animations:WaitForChild("SwordSlash1")

local swordSlash2Track = animations:WaitForChild("SwordSlash2")

local swordSlash3Track = animations:WaitForChild("SwordSlash3")

local swordEquipAnimation = humanoid:LoadAnimation(swordEquipTrack)

local swordIdleAnimation = humanoid:LoadAnimation(swordIdleTrack)

local swordSlash1Animation = humanoid:LoadAnimation(swordSlash1Track)

local swordSlash2Animation = humanoid:LoadAnimation(swordSlash2Track)

local swordSlash3Animation = humanoid:LoadAnimation(swordSlash3Track)

local slashCounter = 0

local function playSound(sound, parent)

local clonedSound = sound:Clone()

clonedSound.PlayOnRemove = true

clonedSound.Parent = parent




if humanoid.Health <= 0 or not humanoid then return end



I don’t really know if you need more of my sword’s code but even after putting a print() in the Equipped event and using the :EquipTool() code I posted, it doesn’t print anything which I think is suggesting that the Equipped event is somehow not even firing when I use :EquipTool() with costumes. My sword works completely fine with the normal R15 block rig though so I really don’t know what could be wrong.

1 Like

When you say that you put a print statement in the Equipped event, is it directly under it or below the humanoid check statements? Are there any infinite yields or concerning console messages that point towards your tool’s LocalScript?

The print statement was directly under the Equipped event. There is also no infinite yields or console messages that are from my tool’s localscript.

I also tried reproducing this issue on a fresh baseplate and the same issue still occurs so I don’t think it’s a problem with my tool’s scripts or my game.

Have you tried seeing if the script is even running by testing print at top and after variables are established? May also try a wait() right after parenting the tool

1 Like

The script does run when I try to put a print statement on top and after the variables are established but none of the events in the tool fire such as the Equipped event and Activated event.

Using this script fixed my problem:

	local tool = tools:WaitForChild("SwordRegion"):Clone()
	repeat wait() until player.Character
	local character = player.Character
	tool.Parent = character

It’s kinda hacky but for some reason I guess it works.