How to add tools / accessories to Player's Character

I want to make it so when a player joins a part is attached into them.
I tried a way of welding , but I heard that this one method of accessories is better.

I tried it and it doesn’t work.

game.Players.PlayerAdded:Connect(function(Player)
	player.CharacterAdded:Connect(function(Character)
		local sword = game.ServerStorage.Sword
		
		local hum =	Char:FindFirstChild("humanoid")
		
		hum:AddAccessory(sword:Clone())
		
	
		
		
	end)
end)
1 Like

Try giving the clone its own variable first (plus i capitalized humanoid and some other changes):

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local sword = game.ServerStorage.Sword
		
                local swordClone = sword:Clone()
                local swordClone.Parent = game.ServerStorage

		local hum =	Character:FindFirstChild("Humanoid")
		
		hum:AddAccessory(swordClone)
		
	
		
		
	end)
end)

That actually won’t work.
.parent isn’t working

Try this instead, and let me know if there are any errors in the output window:

game.Players.ChildAdded:Connect(function(player)
	
		local sword = game.ServerStorage.Sword
		
                local swordClone = sword:Clone()
                local swordClone.Parent = game.ServerStorage

		local hum =	player.Character:WaitForChild("Humanoid")
		
		hum:AddAccessory(swordClone)

	
end)

If you want it to attach to player upon start, follow this example:
https://developer.roblox.com/en-us/api-reference/function/Humanoid/AddAccessory

first tools and accessories have BIG difference
to add tools to players character

clone the tool. place it in the player’s backpack
do

hum:EquipTool(--[[path to tool]])

This post has nothing to do with the tool object , only accessories and parts

Sorry , I meant that the waitforchild gets am error

Did you try the link i put underneath the code?

If you want it to attach to player upon start, follow this example:
https://developer.roblox.com/en-us/api-reference/function/Humanoid/AddAccessory

nvm I had another problem , should be fixed now

Can you please post which script worked for you so future people searching for this solution can see what worked and use it for themselves.

1 Like

Sorry, I am not so experienced with the forum , haha
This works I just happened to have a spelling mistake.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(Character)
		
local sword = game.ServerStorage.Sword  `-- location of Accessory (added my twist to it in my original script)`
		
                local swordClone = sword:Clone()
                 swordClone.Parent = game.ServerStorage

		local hum =	player.Character:WaitForChild("Humanoid")
		
		hum:AddAccessory(swordClone)

	
end)
end)