I am creating a admin thing and I want the admins to be able to regen when there heath changes.
There is a .Changed event. You would use it like so:
1 | function changed() |
2 | player.Humanoid.Health = 100 |
3 | end |
4 |
5 | instance.Changed:Connect(changed) |
You will use the 'HealthChanged' function as stated above. If for some reason you have the health higher than 100, this will set it to the maxhealth
01 | game:GetService( "Players" ).PlayerAdded:Connect( function (plr) |
02 |
03 | plr.CharacterAdded:Connect( function (char) |
04 |
05 | local Humanoid = char:FindFirstChildOfClass( "Humanoid" ) |
06 |
07 | Humanoid.HealthChanged:Connect( function () |
08 |
09 | Humanoid.Health = Humanoid.MaxHealth |
10 |
11 | end ) |
12 |
13 | end ) |
14 |
15 |
16 |
17 |
18 |
19 | end ) |