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 7 years ago
Mouse.KeyDown:connect(function(key)
    if key == "q" then
            if game.Players.LocalPlayer.leaderstats.Level.Value == 1 then
                if Banana == 1 then
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Banana = 0
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    Banana = 1
                end
            end
        end
    end
end

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 — 7y

2 answers

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

Mouse.KeyDown:connect(function(key)
    if key == "q" then
            if game.Players.LocalPlayer.leaderstats.Level.Value == 1 then
                if Banana == 1 then
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Banana = 0
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    game.Players.LocalPlayer.leaderstats.Exp.Value = game.Players.LocalPlayer.leaderstats.Exp.Value + 10
                    Part = Instance.new("Part", workspace)
                    Part.CanCollide = false
                    Part.Transparency = 1
                    c = game.Workspace["Clone Scripts"].FireBoltDamage:Clone()
                    c.Name = "Damage"
                    c.Parent = Part
                    FireParticles = Instance.new("ParticleEmitter", Part)
                    FireParticles.Color = ColorSequence.new(Color3.fromRGB(255, 128, 16))
                    FireParticles.Lifetime = NumberRange.new(0.1, 0.5)
                    FireParticles.LightEmission = 0.25
                    FireParticles.Size = NumberSequence.new(10)
                    FireParticles.LockedToPart = true
                    FireParticles.Speed = NumberRange.new(1)
                    FireParticles.Rate = 20
                    PartMovement = Instance.new("BodyVelocity", Part)
                    Part.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(1, 1, -5)
                    Part.BodyVelocity.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 85
                    wait(3)
                    Part:Destroy()
                    wait(0.1)
                    Banana = 1
               end
           end
       end
end)
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 — 7y
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 — 7y
Ad
Log in to vote
0
Answered by 7 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