Setting the player model

sorry for the load of threads im posting guys, but there is so few documentation that i have to post here.

i am trying to make a guy thingy opened by pressing the M key that lets you change your model between combine and rebel.

this is shared.lua

[lua]
GM.Name = “Half Life 2: Team Fortress”
GM.Author = “Tera”
GM.Email = “gabrycir@hotmail.it”

DeriveGamemode( “base” )

team.SetUp( 1, “Combine”, Color( 0, 50, 200, 255 ) )
team.SetUp( 2, “Resistance”, Color( 200, 0, 0, 255 ) )

function change_model_combine()
local ply = LocalPlayer()
ply:SetModel(“models/combine_soldier.mdl”)
end

function classchange()
Msg (“M HAS BEEN PRESD”)

if CLIENT then
	local Frame = vgui.Create("Frame");
	Frame:SetSize(200, 200)
	Frame:SetPos((ScrW()/2)-100, (ScrH()/2)-100)
	Frame:SetVisible(true)
	Frame:MakePopup()
	Frame:PostMessage("SetTitle", "text", "This is the title")
	
	local Button = vgui.Create("Button", Frame)
	Button:SetText("Click me")
	Button:SetPos(30, 100)
	Button:SetWide(100)
	function Button:DoClick()
		change_model_combine()
		frameopen = false
	end
	//local old = PANEL:Close
	//function PANEL:Close( )
	//	frameopen = false
	//	old( self )
	//	end
end

end

frameopen = false

local function Think( )

if( input.IsKeyDown( KEY_M ) and frameopen ~= true ) then
	
	-- m key was pressed
	
	frameopen = true
	classchange()
	
elseif( keydown == true ) then
	
	
	
end

end
hook.Add( “Think”, “CheckKeyInput”, Think );
[/lua]

the code doesn’t raise errors, but when i press the button my model doesn’t change… why?

You need to do it on the server.

Make a console command and have the button run that.