Shouldnt a MaxHealth Change automatically reduce Health to new MaxHealth

title describes it mainly.
server script changes a humanoids max health to 80
the humanoid health however remains at 100 until set otherwise

i have no problem with just adding this on manually just curious if this is a bug or something open for discussion.

Seems to be a bug, changing the Health property after setting MaxHealth to something lower automatically clamps it and sets it to the new MaxHealth.

Basically, if you set MaxHealth to 50 and then set Health to 1000 from 100, then it’ll automatically go down to 50, and for some reason act like you took damage and show the red damage effect.

unfortunatly i dont have access to disccusion for whatever reason (; and i alreadhy added that just came hhere for other thoughts

This seems a little long-winded, you could just write a wrapper which changes both properties at once or just explicitly assign each property when necessary.

local function changeHealth(humanoid, health)
	humanoid.MaxHealth = health
	humanoid.Health = health
end

It depends on what behavior you’re trying to achieve, I was under the impression that the thread’s poster wanted them to be changed in tandem with one another. It’s a relatively simple change.

local function changeHealth(humanoid, health)
	humanoid.MaxHealth = health
	humanoid.Health = if health > humanoid.Health then humanoid.Health else health
end

yeah PAGOTATZIS" is correct here

^ is exactly what happens

if you need context as to why urs doesnt work :
food poisoning reduces the max health, to 80 you can get food poisoning when your health is less than the max so i dont want to increase the health to 80 rather reduce it if its over the max health.

It does work it’s just not the desired behavior, the second code snippet I provided would fit the criteria for the desired behavior.