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

Script not changing player's max health?

Asked by
rower86 35
4 years ago

A local script sends a remote event to the script and the script uses player as the parameter to go into the maxhealth, but whenever a script like this is written:

RemoteEvent.OnServerEvent:Connect(function(player)
    local maxhealth = player.Character.Humanoid.MaxHealth
    maxhealth = 200
end)

nothing seems to happen to the max health of the player, and no errors are shown whatsoever

1 answer

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

the variable will be equal to the MaxHealth of the player and in the next line of your code you will only change the variable to 200

use this

RemoteEvent.OnServerEvent:Connect(function(player)
    local maxhealth = 200
    player.Character.Humanoid.MaxHealth = maxhealth 
end)
0
thank you, this information will prevent a lot of bugs in the future rower86 35 — 4y
0
No problem PepeElToro41 132 — 4y
Ad

Answer this question