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

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

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.

1 comment

0

Try CFraming the NPC's arm and sword.

2 answers

✓ Accepted answer

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 comment

1

Then I could just change it from a clicked event to a loop. Thanks!

^ You forgot the connection line :P

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