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

How do i add a part on a npc then the part follow npc?

Asked by 5 years ago
Edited 5 years ago

I made a npc,and he has a part.
But when the npc moves,the part won't move...
I want to know how to make it. Thanks!
My codes:

local Noob = script.Parent
local Look = Noob.Part

Look.Touched:connect(function(otherPart)
    if otherPart.Parent.PlayerScript ~= nil then
        --something happened
    end
end)

Yes that part i named Look,When the player touched Look,it will make something happened.
But Look won't follow npc when he is patrolling.

PatrollingScript:

while true do
    script.Parent.Humanoid:MoveTo(workspace.Part.Position)
    script.Parent.Humanoid.MoveToFinished:wait()
    script.Parent.Humanoid:MoveTo(workspace.Part1.Position)
    script.Parent.Humanoid.MoveToFinished:wait()
end

There are two scripts.
Thanks!
By the way, the part is in front of npc.

0
That look part won't follow the humanoid because you didn't do anything with that part in Touched event. I'm not really sure what you want to do but I suggest parenting the part to a model where humanoid is parented when Touched event is fired on that part. g1o2r3d4a5n6 350 — 5y
0
What is that part and what are you trying to do? valchip 789 — 5y
0
This part is for the enemy find player then start card fight. MEndermanM 73 — 5y
0
To g1o2r3d4a5n6: i want make it follow npc, but i don't know how and i can't find it. MEndermanM 73 — 5y

Answer this question