Okay, so a backstory:
I've whipped up a tool that heals you, but one problem is that the healing doesn't stop at the Max Health, and just keeps on healing your health above the Max Health, which is a problem as you could turn yourself into a monster with 1000+ health, when you're only supposed to have 100. Instead of fixing this, I decided it would be neat to turn it into a feature and make it to if you "overheal" yourself you can poison yourself and die.
So now I created a LocalScript that would quickly drain your health once you're 50 hp above your Max Health (I'm EXTREMELY NEW to scripting, and this is my first try at creating a script):
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
function Kill()
if Humanoid.Health > Humanoid.MaxHealth+50 then
repeat
Humanoid:TakeDamage(30)
wait(1)
until Humanoid.Died
end
end
Kill()
I know that I wrote a script that's entirely wrong (I've tested it) and I'm hoping if I could find what's wrong with it, and find out how I can fix it.
It would also help if you can show me what's wrong with the script to help me for future scripts I may write.
EDIT:
Ok 6 month later, me reading this again I've seen the problem. Old me forgot to loop it.
EDIT 2:
Ok pogger me like 1.5 years later wants to say hi.

1 comment
When you run this in studio, what does the console say?