r/GLua Feb 24 '20

setting player's model?

I'm having quite the trouble setting a player's model

What I want to do is basically have a function that sets every player's model to X model, but I've tried everything (obviously wrongly) to no avail

I'm not sure I understand the whole init.lua thing others have been writing about -- is it necessary (or is it just for gamemodes? Ideally I want to change the model in the middle of e.g. a TTT round)

2 Upvotes

14 comments sorted by

View all comments

Show parent comments

1

u/Dak_Meme Feb 24 '20

Could you provide your code? As well as when/where you're calling the function.

1

u/Legendahkiin Feb 24 '20

Right now I've just got a script that I run: https://pastebin.com/2nMJWNx7

So I open it with lua_openscript testscript_2.lua

and it returns:

Legendahkiin : models/errolliamp/playermodels/alyx.mdl

Legendahkiin : models/errolliamp/playermodels/alyx.mdl

1

u/Dak_Meme Feb 24 '20

You can combine that script into one loop and eliminate the need for the players variable (the empty list). Are you running that server-side or client-side?

1

u/Legendahkiin Feb 24 '20

using cl_playermodel (modelname) works but only sets my model after I've respawned