Hello, I am trying to make a infinite health script and it is not working. It gives me an error (title)
1 | local human = script.Parent:WaitForChild( "Humanoid" ) |
2 | human.HealthChanged:connect( function (health) |
3 | wait() |
4 | human.Health = human.MaxHealth |
5 | end |
Like the error says, the script expected you to add a closing ')' at line 5.
If we remove the functions content that you passed as a argument, it becomes more apparent to what's actually going on.
1 | human.HealthChanged:connect(yourFunction |
Here's how to fix your problem
1 | local human = script.Parent:WaitForChild( "Humanoid" ) |
2 | human.HealthChanged:connect( function (health) |
3 | wait() |
4 | human.Health = human.MaxHealth |
5 | end ) -- this closing parentheses requires to be added |
I'd encourage you to tab your code properly next time, as it becomes easier to read.
1 | Humanoid.MaxHealth = math.huge |
2 | Humanoid.Health = math.huge |
3 | print ( math.huge ) -- inf |
Try this!
1 | local human = script.Parent:FindFirstChild( "Humanoid" ) |
2 | human.MaxHealth = math.huge |
3 | human.Health = math.huge |