Ok, essentially I have a LocalScript inside of a Tool. Everything about my tool works, but I have this pestering error that has been occuring. The error that shows up is as follows, "22:53:00.838 - Players.PLAYERNAMEREDACTED.Backpack.a.LocalScript:29: 'end' expected (to close 'function' at line 6) near 'else'".
Oh, and to explain the script. I have a script where when you equip a tool and press a certain key, there is a blur and music starts playing. When the blur size gets to a certain value, there is a for loop which gives the effect of text appearing. I only need to work on syntax errors. Also, if any of my vocabulary is wrong, please bear with it as I'm coming back to scripting in Roblox after a while, so I could be a little rough on it.
This is the code I have, as is listed below. I really need help with fixing up the ends, and I believe every if, function, and else has an end statement. All help is appreciated!
local music = script.Parent:WaitForChild("Piano")
visibleValue = workspace.HeyKids.Value
local blur = game.Lighting:WaitForChild("BlurEffect")
local player = game.Players.LocalPlayer
local tool = script.Parent
tool.Equipped:Connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key:byte() == 96 then
music.Playing = true
music.Looped = true
for m = 0,24.1,.1 do
wait(.1)
blur.Size = m
if blur.Size == 24 then
visibleValue = true
end
end
if visibleValue == true then
for i = 1,0,-.05 do
player.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency = i
wait(.01)
end
else
player.PlayerGui.ScreenGui.Frame.TextLabel.TextTranparency = 1
end
end
end)
else if key:byte() == 127 then
music.Playing = true
music.Looped = true
for n = 0,12.05,.05 do
wait(.05)
blur.Size = n
if blur.Size == 12 then
coolValue = true
end
if coolValue == true then
player.PlayerGui.ScreenGui.Frame.TextLabel.Text = ("i have the high ground")
for b = 1,0,-.05 do
player.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency = b
wait (.01)
end
else
player.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency = 1
end
end
end
end
end)
end)
tool.Unequipped:Connect(function()
player.PlayerGui.ScreenGui.Enabled = false
music.Playing = false
blur.Size = 0
end)
If anyone can help, please list what is needed so I can get to work.

3 comments
You added elseif after closing your function? That won't work.
You added elseif after closing your function? That won't work.
dont ue keydown, it is deprecated, use InputBegan instead