Hello, I am trying to make a infinite health script and it is not working. It gives me an error (title)
local human = script.Parent:WaitForChild("Humanoid")
human.HealthChanged:connect(function(health)
wait()
human.Health = human.MaxHealth
end
Hello, I am trying to make a infinite health script and it is not working. It gives me an error (title)
local human = script.Parent:WaitForChild("Humanoid")
human.HealthChanged:connect(function(health)
wait()
human.Health = human.MaxHealth
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.
human.HealthChanged:connect(yourFunction
Here's how to fix your problem
local human = script.Parent:WaitForChild("Humanoid")
human.HealthChanged:connect(function(health)
wait()
human.Health = human.MaxHealth
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.
Humanoid.MaxHealth = math.huge
Humanoid.Health = math.huge
print(math.huge) -- inf
Try this!
local human = script.Parent:FindFirstChild("Humanoid")
human.MaxHealth = math.huge
human.Health = math.huge
This discussion is preserved as it was. New answers, comments, and votes are closed.