Error "attempt to index global 'gui' (a nil value)" ... help

I want to create a simple .lua code that when a player types !css or /css it will open in the steam overlay the location where he can download the css content addon…
I am getting this error:



[ERROR] lua/autorun/css_addon.lua:4: attempt to index global 'gui' (a nil value)
  1. v - lua/autorun/css_addon.lua:4
   2. unknown - lua/includes/modules/hook.lua:84


Here’s the code:



if ( SERVER ) then
	hook.Add("PlayerSay", function(ply, text)
		if (text=="!css" or text=="/css") then
			gui.OpenURL("http://domain.com")
			print("!css or /css typed")
		end
	end)
end


Any tips?

gui.OpenURL is a clientside function. You’re running it on the server.

Ok, thanks will use network functions for this then :slight_smile: