I want to make it so when a player gains strength their health also goes up. I'm a new scripter so I have no idea what I'm doing and I'm stuck.
This is what i tried so far but the health does no go up, nothing in output either.
local DefaultHealth = 100
game.Players.PlayerAdded:Connect(function(player)
local Stats = player:WaitForChild("leaderstats")
local Strength = Stats:FindFirstChild("strength")
local char = player.Character or player.CharacterAdded:wait()
if char then
local hum = char:FindFirstChild("Humanoid")
if hum then
hum.MaxHealth = DefaultHealth * Strength.Value
end
end
end)
update: I had this script above in a local script under starter character so i moved it into a script under server script and when i tested, the players maxhealth went to 0.

2 comments
maybe the Strength.Value is 0?
the player has over 2000 strength tho so how can that be?