Why Doesn't My Player's MaxHealth Change?
I made a localscript where when a remote event is fired through the server, the health of the player changes to the value of an IntValue named "HealthValue" . I also made a while wait loop which constantly sets the max health of the player to the IntValue. There are also some other things in this script that aren't relevant to the problem
01 | local players = game:GetService( "Players" ) |
02 | local plr = players.LocalPlayer |
03 | local char = plr.Character |
04 | local hum = char:WaitForChild( "Humanoid" ) |
05 | local jumppower = hum.JumpPower |
06 | local WalkSpeed = hum.WalkSpeed |
07 | local HealthChange = hum.Health |
09 | game.ReplicatedStorage.HealthEvent.OnClientEvent:Connect( function () |
10 | hum.Health = script.Parent.CharacterSelection.Background.HealthValue.Value |
15 | hum.JumpPower = script.Parent.CharacterSelection.Background.JumpValue.Value |
16 | hum.WalkSpeed = script.Parent.CharacterSelection.Background.SpeedValue.Value |
17 | hum.MaxHealth = script.Parent.CharacterSelection.Background.HealthValue.Value |
I tested this script using a kill brick that decreases the player's health by 5 each time, and the value of the health and the maxhealth do change, however, when i touch the killbrick, the health resets to 100 and 100 becomes the maxhealth as well. Any ideas how to fix? Thanks. Also keep in mind, that the player's humanoid's maxhealth does display the IntValues value, and this doesnt give any errors either