This is the blow code from the generic Windforce sword. I'm trying to manipulate the sword with a custom animation and when I delete the following chunk of code, it stops the swing of the sword completely. Can someone please explain what this code is doing in English that I can understand?

	local humanoid = hit.Parent:findFirstChild("Humanoid")
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if humanoid~=nil and humanoid ~= hum and hum ~= nil then
		-- final check, make sure sword is in-hand
		local right_arm = vCharacter:FindFirstChild("Right Arm")
		if (right_arm ~= nil) then
			local joint = right_arm:FindFirstChild("RightGrip")
			if (joint ~= nil and (joint.Part0 == handle or joint.Part1 == handle)) then
				if Tool.Enabled == false then
				tagHumanoid(humanoid, vPlayer)

2 comments

0

It's a lot easier to explain the base functions and syntax of the Lua language so you can understand yourself. It'd take too long to explain what everything is doing and how everything is working in a chunk of code. Also, this code isn't even very good.

0

I think I understand what it's doing now. Anyways my issue was that the sword isn't compatible with R15. After adding a Force R6 script, it works fine. I should have considered that before.