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
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
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
12 comments
Deleted mine cause of the Changed event, but FYI you should be doing LVL . Value * 100
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?
put the script in StarterPlayerScripts and if its FE use RemoteEvents
how do i know if its filtering enabled is it experimental mode?
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
if it helped please accept
thanks a lot
it wooooorks thanks everyoneeeee!!!!!!!
oh wait
it works only in roblox stuidio
maybe the game won't update
Nope the server updated but it still doesn't work,what should i do?