Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how can i get an NPC to equip a sword/tool properly?

I created a simple sword with multiple parts that get welded together with a weld script. When i copy and paste the sword into the npc model only the handle goes to his hand, but the rest of the sword stays behind.

How should i go about getting the npc to actually carry the sword properly? thank you.

1 comment

1 answer

Here is an example

--[[LocalScript in tool]]--


local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local tool = script.Parent

if tool then
	humanoid:EquipTool(tool)
end

3 comments

0

I'm trying to get an NPC to equip the tool, not a player.

0

he said it was a example, :EquipTool() works on NPCs too

0

So, you need to get npc humanoid and equip it

This discussion is preserved as it was. New answers, comments, and votes are closed.