Error with a Lightning Script

So basically im trying to learn code for a Lightning module (Credtis to Petethespeed) and i keep getting an error. Been trying to fix it for awhile and need any kind of assistance. (PS im new to scripting)
f13772c104189274ff2243f581ac08c8

local LightningRemote = game.ReplicatedStorage:WaitForChild("Lightning")

local FxRemote = game.ReplicatedStorage:WaitForChild("FxRemote")

_G.Lightning = {}

LightningRemote.OnServerEvent:Connect(function(Player)
	local Char = Player.Character
	local HumRP = Char:WaitForChild("Humanoid")
	FxRemote:FireClient(Player,Char,"Lightning")
	
	local SavedData = false
	for i,Users in pairs(_G.Lightning) do
		if i == Player.Name then
			SavedData = true
		end
	end
	if SavedData == false then
		-- 1 = Debounce
		_G.Lightning [Player.Name] = {false}
	end
	
	if _G.Lightning [Player.Name][1] == false then
		_G.Lightning [Player.Name][1] = true
		
		delay(3,function()
			_G.Lightning [Player.Name][1] = false
		end)
		
		FxRemote:FireClient(Player,Char,"Lightning")
		
		for i,v in pairs(game.Workspace:GetDescendants()) do
			if v.Name == "HumanoidRootPart" and v:IsA("BasePart") and v.Parent ~= Char then
				local EhumRP = v
				if (HumRP.Position - EhumRP.Position).Magnitude < 20 then
					    local Facing = HumRP.CFrame.lookVector
					    local Vector = (v.Position - HumRP.Position).unit
					
				        local Angle = math.acos(Facing:Dot(Vector))
					 
					    if Angle <= .6 then
					
				        local EHum = v.Parent:FindFirstChild("Humanoid")
				
						EHum:TakeDamage(20)
					end	
				end
			end
		end
	end
end)

This is script is meant for damaging

f13772c104189274ff2243f581ac08c8

As you can see its not working any thoughts?

You’re getting the Humanoid, not HRP.

1 Like

Thank you very much such a simple mistake had my head hurting for an hour

1 Like

Feel free to mark it as the solution.