Question about hooks

Whats the differences between using this

function GM:PlayerInitialSpawn(ply)
print(ply:Name())
end

and this

function idonthinkthisnamematters(ply)
print(ply:Name())
end
hooks.add(“PlayerInitialSpawn”, “cgminitualspawn”, idonthinkthisnamematters)

I recently had a problem with this where I called using GM and it overridden a default method causing some problems such as kill feeds not drawing.

hook.Add is the proper way to add hooks and overriding the GAMEMODE function should only be done if you’re making a gamemode or you’re forced to.

To add on to what he said, basically the top function overrites the function that could potentially be used by other addons or the gamemode. Adding a hook, rather, makes it so that it doesn’t interfere with other uses of that function. It’s the safer way.

I am making a gamemode, should I use the 2nd method for HUDPaint?

You should using a GAMEMODE/GM override if you are making a gamemode. Hooks are for non-gamemode addons.

Alright thanks for the help.