Script Error: Expected <eof> ,got 'end'

While I was writing my code I stumbled across an error. I tried deleting it but didn’t work. Any help will be appreciated.

for i,Part in pairs(game.Workspace.Maps:GetChildren()) do
if(Part:IsA(“Part”)) then
Part.Touched:Connect(function(hit)
if (game:GetService(“Players”):GetPlayerFromCharacter(hit.Parent)) then
local player = game:GetService(“Players”):GetPlayerFromCharacter(hit.Parent)

			if(Part.Name == "TeleportMagic1") then
				if(player.MapVtojh.Value == "Map1") then
				elseif (player.MapVtojh.Value == "Map2") then
					player.MapVtojh.Value = "Map1"
                                            workspace.MapUpVote.Map2.Value - 1
                                            workspace.MapUpVote.Map1.Value + 1
				elseif (player.MapVtojh.Value == "Map3") then
					player.MapVtojh.Value = "Map1"
                                            workspace.MapUpVote.Map3.Value - 1
                                            workspace.MapUpVote.Map1.Value + 1
				elseif (player.MapVtojh.Value == "") then
					player.MapVtojh.Value = "Map1"
                                            workspace.MapUpVote.Map1.Value + 1
				end
				
			elseif(Part.Name == "TeleportMagic2") then 
				if(player.MapVtojh.Value == "Map2") then
				elseif (player.MapVtojh.Value == "Map1") then
					player.MapVtojh.Value = "Map2"
                                            workspace.MapUpVote.Map2.Value + 1
                                            workspace.MapUpVote.Map1.Value - 1
				elseif (player.MapVtojh.Value == "Map3") then
					player.MapVtojh.Value = "Map2"
                                            workspace.MapUpVote.Map3.Value - 1
                                            workspace.MapUpVote.Map2.Value + 1
				elseif (player.MapVtojh.Value == "") then
					player.MapVtojh.Value = "Map2"
                                            workspace.MapUpVote.Map2.Value + 1
				end
				
			elseif(Part.Name == "TeleportMagic3") then 
				if(player.MapVtojh.Value == "Map3") then
				elseif (player.MapVtojh.Value == "Map1") then
					player.MapVtojh.Value = "Map3"
                                            workspace.MapUpVote.Map3.Value + 1
                                            workspace.MapUpVote.Map1.Value - 1
				elseif (player.MapVtojh.Value == "Map2") then
					player.MapVtojh.Value = "Map3"
                                            workspace.MapUpVote.Map2.Value - 1
                                            workspace.MapUpVote.Map3.Value + 1
				elseif (player.MapVtojh.Value == "") then
					player.MapVtojh.Value = "Map3"
                                           workspace.MapUpVote.Map3.Value + 1
				end

							end
						end
					end)
				end
			end
		end) --- Error
	end)
end

end

10 Likes

You have several extra ends. It’s saying it expected the script to be over, but you put an extra end there instead. (EOF = end of file)

24 Likes

Sorry 1/3 of the script has been cut off. This is only my first time.

2 Likes

I tried deleting four ends and it worked! Thank you!

5 Likes