|
Hello there,
Im making some kind of script to display a users health.
it works fine and well but when i apply armour it doesnt work.....
heres my script im using:
while true do
local hmn = script.Parent.Parent.Character.Humanoid
local lvl = script.Parent.Parent.leaderstats.Lvl
local con = script.Parent.Parent.attributes.Constitution
hmn.MaxHealth = MaxHealth + (lvl.Value*10) + (con.Value*5) + 100
wait(0.1)
end
the armor adds maxhealth obviously and i have an attribute system that also players can add to max health too.
so what i need is it to get the players maxhealth first, then add the attributes maxhealth bonus to it after.
Can anyone help please. |
|
|
i'll take a better look at in in a bit, but for better efficiency, you should try while wait(.01) do, i mean it's not vital, but it certainly is neater in the end
-your friendly neighborhood scripter |
|
|
ok thanks, i had made the changes you said.
Thanks
Rich |
|
|
i think, its needs to get the global variable maxhealth, then adds the "(lvl.Value*10) + (con.Value*5) + 100" after that, but then not run in a loop as when i do that it just keeps adding 100 to the health every .01 seconds and wont stop...
Thanks
Rich |
|
|
Anyone had a chance to look yet? My brain can't work out why it isn't working and really need help.
Thankrich |
|
|
hmn.MaxHealth = hmn.MaxHealth + (lvl.Value*10) + (con.Value*5) + 100 |
|
|
Tried that, just continuously adds 100 to max health every .01 second in a loop and doesn't stop.
That was the first thing I did.
Thanks
Rich |
|
|
Because its in a loop -_- |
|
Saldor010Join Date: 2010-09-20 Post Count: 1035 |
Don't use a loop for something like this. Only have it triggered every time the person spawns and every time they level up. Also, I wouldn't use armor in conjunction with health, It'd probably be much more simple and easier to just have it be its own variable in combat when you're being attacked. |
|
|
But it doesn't work when I take it out of the loop -_- |
|
Saldor010Join Date: 2010-09-20 Post Count: 1035 |
If you're that helpless, then get out of this forum. I already told you what you need to do, now go do it. Unless this is a script you didn't even write yourself, in that case, get out of this forum. |
|
|
oh shud'dupa you face! ill do it when i get home from work |
|