I have a script and i keep getting the error "Attempt to index nil with nil with ‘Health’ ", However the code that I am using still works without issue (besides the error), and I know that its this script specifically, because when I deleted the code, nothing happened. I have pasted the code below,.
-- server script inside a tool
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player, hithum)
if hithum == Player.Character.Humanoid then
else
hithum.Health -= 7
end
end)
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player, hithum)
if hithum == Player.Character.Humanoid then
elseif hithum ~= nil and hithum.ClassName == "Humanoid" then
hithum.Health -= 7
end
end)