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

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

Asked by
Echtic 128
6 years ago
Edited 6 years ago

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

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

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.

0
Deleted mine cause of the Changed event, but FYI you should be doing LVL . Value * 100 blowup999 659 — 6y
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? Echtic 128 — 6y
0
put the script in StarterPlayerScripts and if its FE use RemoteEvents abnotaddable 920 — 6y
0
how do i know if its filtering enabled is it experimental mode? Echtic 128 — 6y
View all comments (8 more)
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 abnotaddable 920 — 6y
0
if it helped please accept abnotaddable 920 — 6y
0
thanks a lot Echtic 128 — 6y
0
it wooooorks thanks everyoneeeee!!!!!!! Echtic 128 — 6y
0
oh wait Echtic 128 — 6y
0
it works only in roblox stuidio Echtic 128 — 6y
0
maybe the game won't update Echtic 128 — 6y
0
Nope the server updated but it still doesn't work,what should i do? Echtic 128 — 6y
Ad

Answer this question