Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago

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 answer

Log in to vote
0
Answered by
HaveASip 494 Moderation Voter
5 years ago

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
0
I'm trying to get an NPC to equip the tool, not a player. PoePoeCannon 519 — 5y
0
he said it was a example, :EquipTool() works on NPCs too User#23365 30 — 5y
0
So, you need to get npc humanoid and equip it HaveASip 494 — 5y
Ad

Answer this question