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
local players = game:GetService("Players")
local plr = players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local jumppower = hum.JumpPower
local WalkSpeed = hum.WalkSpeed
local HealthChange = hum.Health
game.ReplicatedStorage.HealthEvent.OnClientEvent:Connect(function()
hum.Health = script.Parent.CharacterSelection.Background.HealthValue.Value
end)
while wait() do
hum.JumpPower = script.Parent.CharacterSelection.Background.JumpValue.Value
hum.WalkSpeed = script.Parent.CharacterSelection.Background.SpeedValue.Value
hum.MaxHealth = script.Parent.CharacterSelection.Background.HealthValue.Value
end
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

3 comments
You have the change the health too
What is your goal? It’s kind of hard to read (not grammarly). Like make it more understandable of what do you want to achieve
I think problem you are having is because you are changing MaxHealth and Health from LocalScript, try using Remote events, place server script in serverscriptservice