Help with random player models?

Hello I have been trying to implement random playermodels on my server and for some reason my models arent working correctly, there are no models, no errors and no weapons now, what did I do wrong? Heres a pastebin of the stuff I put in, please help <3

EDIT: Nvm, it was something in my init.lua ignor the post now

I know you fixed it, but don’t use GM:PlayerSetModel and override the function; use a hook.

How would I use a hook to do this, am noobe pls halp

Read that and you’ll understand.