Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 " 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.

1 comment

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.

2 answers

✓ Accepted answer

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)

2 comments

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.

1

Just for those who stumble across this post who may also be confused about the question or answer, for some additional insight.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.