Character dying when I mess with the health values?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make the gradient go down if the character’s health changes.
  2. What is the issue? Include screenshots / videos if possible!
    Character dies if I try to mess with any of its health values, including maxhealth.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried using a damage brick that hurts only 1 damage every 2 seconds, still dies right when I touch it even though im at 100 health, I tried changing it to 99 in studio itself, auto changes it to 0 for some reason, I tried changing the max health but again auto changes to 0.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

This can’t be a problem with the script as it never changes the health value of my character, it only receives it.

Test this in a completely empty place. It looks like an issue created by one of your game scripts. Since you mention this also happens with max health, perhaps something is checking the condition health/maxhealth == 1 to decide if it should keep the character alive or reset it? Or something could be manually checking both values for non-default values?

Also, is this happening when you change the client or server values?

Personally, if that happened to me I would analyze every script related to anti-cheats, custom character controls, kill bricks, and anything related to the character or to damage in one way or another in search of suspicious code samples causing this. Then I would disable those systems one at a time or multiple at a time, trying to figure out what exactly is causing the issue. If I still wasn’t able to point it down to a specific issue, I’d disable everything and re-enable things one by one trying to figure out what exactly causes it.