Part can't get parented to the tool

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make a script that parents a part to the tool that has the same name as the handle’s previous parent (Group called “Greatsword”).

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that my script isn’t working. Also it prints nil when I have equipped the tool.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I didn’t find any solutions for my problem.

-- Variables
local player, character, humanoid, tool

character = script.Parent.Parent
humanoid = character:FindFirstChild("Humanoid")
player = Players:GetPlayerFromCharacter(character)

print("Character, humanoid and player is set in the variable.")

character.ChildAdded:Connect(function(Obj)
	print(Obj.Name)
	if Obj:IsA("Tool") and Obj:FindFirstChild("Auth") then
		if Obj:FindFirstChild("ASCS - Auth") then
			ASCS.Models:FindFirstChild(Obj.Name).Handle:Clone().Parent = Obj
			tool = Obj
		end
	end
end)

wait(5)
print(tool.Name)

Fixed with another simpler method. I’ve put the scripts inside the tool.

2 Likes