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 5 years ago

Hello, I am trying to make a infinite health script and it is not working. It gives me an error (title)

1local human = script.Parent:WaitForChild("Humanoid")
2human.HealthChanged:connect(function(health)
3wait()
4human.Health = human.MaxHealth
5end

3 answers

Log in to vote
0
Answered by
ScuffedAI 435 Moderation Voter
5 years ago
Edited 5 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.

1human.HealthChanged:connect(yourFunction

Here's how to fix your problem

1local human = script.Parent:WaitForChild("Humanoid")
2human.HealthChanged:connect(function(health)
3    wait()
4    human.Health = human.MaxHealth
5end) -- 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 5 years ago
1Humanoid.MaxHealth = math.huge
2Humanoid.Health = math.huge
3print(math.huge) -- inf
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Try this!

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

Answer this question