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

Why do I keep getting the error "<eof> expected near end"?

Asked by 8 years ago
01Mouse.KeyDown:connect(function(key)
02    if key == "q" then
03            if game.Players.LocalPlayer.leaderstats.Level.Value == 1 then
04                if Banana == 1 then
05                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
06                    Part = Instance.new("Part", workspace)
07                    Banana = 0
08                    Part.CanCollide = false
09                    Part.Transparency = 1
10                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
11                    c.Name = "Damage"
12                    c.Parent = Part
13                    FireParticles = Instance.new("ParticleEmitter", Part)
14                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
15                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
View all 95 lines...

The error I keep getting is "<eof> expected near end" and I cannot for the life of me figure out why this happens and how to stop it.

The script doesn't work without it.

0
Remember, error messages tell you the specific line of code which yields the issue. Nathan already pointed it out in his answer, which I also left a comment on, but remember and analyze this for future reference. ScriptGuider 5640 — 8y

2 answers

Log in to vote
0
Answered by
Async_io 908 Moderation Voter
8 years ago
Edited 8 years ago

You're using an extra end and using a connect function, which requires an ending )

If you use a normal function, you don't have to use the ); however, if you use it in a connect function, you need to have a ) on the end. I.e end).

Sorry if I made that confusing :P.

01Mouse.KeyDown:connect(function(key)
02    if key == "q" then
03            if game.Players.LocalPlayer.leaderstats.Level.Value == 1 then
04                if Banana == 1 then
05                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
06                    Part = Instance.new("Part", workspace)
07                    Banana = 0
08                    Part.CanCollide = false
09                    Part.Transparency = 1
10                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
11                    c.Name = "Damage"
12                    c.Parent = Part
13                    FireParticles = Instance.new("ParticleEmitter", Part)
14                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
15                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
View all 94 lines...
1
Just to clarify, the closing parenthesis follows the end statement because it's being passed as an argument to "connect". Arguments are enclosed with parenthesis, therefore the anonymous function is no exception. ScriptGuider 5640 — 8y
1
Just for those who stumble across this post who may also be confused about the question or answer, for some additional insight. ScriptGuider 5640 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

If you're using a function like this, you need to use ) at the last 'end' of your function script.

Answer this question