Changing caller model on derma?

I want to do it so when the player presses the button it changes his playermodel.
How do i do that? I can’t find anything helpful



local DButton = vgui.Create( "DButton", DPanel )
	DButton:SetPos( 10, 270 )
	DButton:SetText( "Join Blue Team" )
	DButton:SetSize( 120, 60 )
	DButton.DoClick = function( ply )
		ply:SetModel( "models/humans/Group03/male_02.mdl" )
        end


I suppose it’s something along the lines of this? I’m pretty new to this myself

SetModel needs to be called on the server, you would need to do some networking.

Fixed by using LocalPlayer():…

Actually it doesn’t work on multiplayer, just singleplayer.
Any idea?

In a clientside file



local DButton = vgui.Create( "DButton", DPanel )
	DButton:SetPos( 10, 270 )
	DButton:SetText( "Join Blue Team" )
	DButton:SetSize( 120, 60 )
	DButton.DoClick = function( ply )
		RunConsoleCommand("heytroll")
        end


In a serverside file



function heylol 
  ply:SetModel("models/humans/Group03/male_02.mdl")
end
concommand.Add("heytroll", heylol)

Dont use console commands when doing somthing like this. As people will learn them and then take advantage of them.

Speaking of which, does anyone know where I can find the player model directories to accomplish something like this?

Any other ideas? Using console is a problem because there’s alot of items. Like what, i should create each command for an item?
Actually how do i add parameters (like the console “say” cmd)

local DButton = vgui.Create( “DButton”, DPanel )
DButton:SetPos( 10, 270 )
DButton:SetText( “Join Blue Team” )
DButton:SetSize( 120, 60 )
DButton.DoClick = function() net.Start(“plymodel”) net.SendToServer() end

then server side:

util.AddNetworkString(“plymodel”)
net.Receive(“plymodel”, function()
LocalPlayer():SetModel(“models/humans/Group03/male_02.mdl”)
end )

untested and might not work, wrote this on hpone, correct me if im wrong

I have 17 items, what am i suppose to do? 17 commands?

17 models? Make a table?

Too lazy. Isn’t there another fix?

also in the meanwhile

Making a table is probably the easiest to do,

local models = {
“model1”,
“model2”,
“model3”
}