wait(4)
local Player = game.Players.LocalPlayer
local MaxHealth = Player.Character.Humanoid.MaxHealth
local CurrentHealth = Player.Character.Humanoid.Health
local MaxHealthVal = Instance.new("IntValue", Player.Character)
local HealthVal = Instance.new("IntValue", Player.Character)
MaxHealthVal.Value = MaxHealth
HealthVal.Value = CurrentHealth
if HealthVal < MaxHealthVal then
DamageDone = MaxHealthVal - HealthVal
print(DamageDone)
MaxHealthVal = HealthVal
end
This script is meant to print the amount of damage whenever it is taken but its given me an error:
Players.xMockery.Backpack.LocalScript:12: attempt to compare two userdata values Script 'Players.xMockery.Backpack.LocalScript', Line 12
Please help.

3 comments
It gets rid of the error but it still doesnt print the damage done. Do you know why?
Well you have to make the person get damaged...
Also this will only work in the first 4 seconds so how about you put it in the touched function? Like if you make a part that damages you a Touched Function so put it in there every time the person gets hurt it will print the damage...