attempt to index global 'vgui' (a nil value)

Hello all, I am making a gamemode for a friend, and the above error comes up. HALP?
Here is my code:

init.lua:


AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "cl_init.lua" )

include( "shared.lua" )

function GM:PlayerInitialSpawn( ply )
	
	ply:SetTeam( 1 )
	ply:Give( "pistol" )
	ply:GiveAmmo( 100, "pistol" )
	
end

function GM:PlayerSpawn( ply )

	ply:SetTeam( 1 )
	ply:Give( "pistol" )
	ply:GiveAmmo( 100, "pistol" )
	
end

function GM:PlayerLoadout( ply )
end

shared.lua:


GM.Name 		= "badmoney"
GM.Author 		= "HERPS THE DERPS"
GM.Email 		= "LULZ@LULZ.LULZ"
GM.Website 		= "www.LULZ.co.uk.edu.org.com"
GM.TeamBased 	= true

team.SetUp(1, "Player", Color(125, 125, 125, 255))

cl_init.lua:


include( "shared.lua" )

local function buy_list()

	local menu = vgui.Create( "DFrame" )
	menu:SetPos(ScrH() / 2, ScrW() / 2)
	menu:SetSize( 400, 400 )
	menu:SetVisible( true )
	menu:SetDraggable( true )
	menu:ShowCloseButton( true )
	menu:MakePopup()

end
concommand.Add( "buy", buy_list )

THANKYOU SO MUCH TO ALL!!!

– Kimzey

It’s because you’re attempting to run cl_init.lua serverside.

Well that’s helpful and all, but how do I make it client side? Or whatever I need to do to fixx it?

Still no help, anyone, please??? I need more information on how to fix this!

Still need halp!

If you don’t know how to fix such an issue, you shouldn’t be making a gamemode for your friend.

Server: The function(s) can only run on the server.
Client: The function(s) can only run on the client.