I keep getting this error and the damage isnt working how do i fix this?

if hit.Parent:FindFirstChild("Humanoid")then
			if hit.Parent.Name ~= plr.Name then
				if DB == false then
					DB = true
					print(SlashDamage)
					wait()
					hit.Parent.Humanoid.Health  = hit.Parent.Humanoid.Health - SlashDamage
					wait(0.5)
					DB = false
				end
			end
		end
	end)

3 comments

0

Do you have output open? If so, it should tell you which part of your script the error is on.

0

It's attempting to subtract a nil value from a number value. Did you set SlashDamage to a valid number?

0

yes its set to 20