Make a Dframe Pop up asoon as you join

So i have created a custom DFrame with everything on it and stuff, make it a chat command console command and all that stuff, but i need to make it just like a MOTD… Does anyone have a hook for that? Also should i put it in Client or Server? Thank you !

GM:PlayerInitialSpawn
Use a net message to tell the client to open the menu.

No, he should be opening it on the client 100%. You don’t need a net message for this.

-I’m dumb, snip-

You could try a clientside

GM:InitPostEntity hook, though I never tried that. Otherwise a surefire way (and clientside only) to do this, is using a Think hook, waiting until LocalPlayer() is valid:

[lua]
local function ShowMOTD()
print(“hello”)
end

hook.Add(“Think”, “OpenMOTD”, function()
if (IsValid(LocalPlayer())) then
hook.Remove(“Think”, “OpenMOTD”)

	ShowMOTD()
end

end)
[/lua]

Or something like ON join run a console command, cuz i made it a console command also is

GM:PlayerConnect
not something we can use?
cuz i have tried everything from above here and nothing works for me…

Give us your code please?

and put it in lua\autorun

If I recall correctly GM:PlayerConnect is for when the player first starts to join the server.
You also need AddCSLuaFile() at the top of your code so the client knows it needs that file
[editline]31st August 2016[/editline]


local function ShowMOTD()
	print("hello")
end

hook.Add("Think", "OpenMOTD", function()
	if (IsValid(LocalPlayer())) then
		hook.Remove("Think", "OpenMOTD")
		
		ShowMOTD()
	end
end)


Works perfectly fine.
Instead of having your frame in the if statement put it in a function, so you can call it from multiple places.


function ShowMotd()
	--MOTD Creation Here
end

hook.Add("Think", "OpenMOTD", function()
	if (IsValid(LocalPlayer())) then
		hook.Remove("Think", "OpenMOTD")
		
		ShowMOTD()
	end
end)


[editline]31st August 2016[/editline]

Also you should use Notepad++ or Sublime and tabulate your code. You may get more help that way, everyone loves clean and easy to read code.
draw.DrawText() or draw.SimpleText() may save you some space also

Imo you should use Atom.io or Sublime. Notepad++ is pretty shitty and its GLua syntax is from Gmod 10/12 or something

[editline]31st August 2016[/editline]

Also, its called indentation not “tabulate”

You’re right, I couldn’t think of the correct term at the moment and that was the first thing that came into mind. But any luck Jason? Something that may help if you don’t already have something is a in-game LUA editor like GCompute or LuaPad.

hmm mthanks

It’s called coding, not “copy pasting”