Damage script not working

Hi, I have absolutely no idea why this damage script won’t work! Like, It doesn’t make sense.
Script:

local car = script.Parent

car.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then
		if hit.Parent.Name == 'Teacher' then
			print('Teacher hit!')
		elseif not hit.Parent.Humanoid.Sit then
			hit.Parent.Humanoid.Health -= script.Parent.Parent.DamageAmount.Value
			hit.Parent.Humanoid.Sit = true
		end
	end
end)

the player sits down but takes no damage!
My damage is an IntValue. It’s value is set to 25.

image

-= doesn’t work in lua, you’d have to write it like this:

hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - script.Parent.Parent.DamageAmount.Value

there is also a better method you can use:

hit.Parent.Humanoid:TakeDamage(script.Parent.Parent.DamageAmount.Value)
1 Like