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

Workspace.Car.Script:6: Expected ')' (to close '(' at line 3), got <eof>?

Asked by 4 years ago

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

3 answers

Log in to vote
0
Answered by
ScuffedAI 435 Moderation Voter
4 years ago
Edited 4 years ago

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.

Ad
Log in to vote
0
Answered by 4 years ago
Humanoid.MaxHealth = math.huge
Humanoid.Health = math.huge
print(math.huge) -- inf
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Try this!


local human = script.Parent:FindFirstChild("Humanoid") human.MaxHealth = math.huge human.Health = math.huge

Answer this question