Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

when damage is taken with custom max health it damages starting from 100 than custom maxhealth?

Asked by 3 years ago

I made a script that changes the player's custom max health to 300 along with the current health. However when I made that player take damage using

Humanoid:TakeDamage(20) 

it makes the health 80 out of 300 because for some reason it removes 20 health from 100 health instead of 300 health. So my end result when taking damage is 80/300 instead of 280/300

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

This could be one of two things:

1. You've set MaxHealth via a LocalScript and Humanoid:TakeDamage(20) is ran on the server. The client and the server see different things. If you set MaxHealth on the client, only the client will see that change. However, the server will not and see it still as 100 HP. 2. You may have perhaps set MaxHealth but have forgotten to set Health. If you're increasing MaxHealth you will also have to set Health to that same value. As an example, let's say you were to set MaxHealth of a player to 3000, only their MaxHealth is 3000, but their Health is still 100.

Unfortunately, you did not attach the script that handles MaxHealth, so I'm left guessing here.

Ad

Answer this question