Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I made this script which should make max health equal to level * 100 why doesn't it work?

I have already made a leveling system and now i want to make max health equal to level * 100. What did i do wrong in this script?

local LVL = Player.LevelingSystem.Lvl


 LVL > 0 while true do

	Player.Character.Humanoid.Maxhealth = LVL * 100

end

1 answer

✓ Accepted answer

Assuming LVL is an instance, we can use .Changed property.
The script HAS to be LOCAL.

local Player = game.Players.LocalPlayer --get the local player
local LVL = Player.LevelingSystem.Lvl --get the level

LVL.Changed:Connect(function() --when it is changed, update the health
	Player.Character.Humanoid.MaxHealth = LVL.Value * 100
	Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth --optional
end)

This will update each time the value is changed.

12 comments

0

Deleted mine cause of the Changed event, but FYI you should be doing LVL . Value * 100

0

Thanks a lot mate! I'm still new at scripting so should i add remote event to that script or should i put it in some specific parent?

0

put the script in StarterPlayerScripts and if its FE use RemoteEvents

0

how do i know if its filtering enabled is it experimental mode?

0

when it says "Experimental Mode" that means fe is off. or just click workspace and in its properties there should NOT be a tick next to FE

0

if it helped please accept

0

thanks a lot

0

it wooooorks thanks everyoneeeee!!!!!!!

0

oh wait

0

it works only in roblox stuidio

0

maybe the game won't update

0

Nope the server updated but it still doesn't work,what should i do?

This discussion is preserved as it was. New answers, comments, and votes are closed.