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

How do I make a NPC lunge with a Roblox sword?

Asked by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

It's simple to do it with a player; you just double click. But an NPC can't double click. So how would you cause an NPC to lunge with a sword?

I can't find any tutorials on this, so I was hoping one of you guys could help me.

0
Try CFraming the NPC's arm and sword. HexC3D 830 — 10y

2 answers

Log in to vote
2
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

From the LinkedSword Script:

function lunge()
    --snip
    wait(.25)
    swordOut()
    wait(.25)
    --snip
    wait(.5)
    swordUp()

    --snip
end

function swordUp()
    Tool.GripForward = Vector3.new(-1,0,0)
    Tool.GripRight = Vector3.new(0,1,0)
    Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
    Tool.GripForward = Vector3.new(0,0,1)
    Tool.GripRight = Vector3.new(0,-1,0)
    Tool.GripUp = Vector3.new(-1,0,0)
end

swordOut changes the Grip CFrame of the Tool to the 'lunge' position. swordUp changes it back to the 'up' position.

1
Then I could just change it from a clicked event to a loop. Thanks! Perci1 4988 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

^ You forgot the connection line :P

Answer this question