ply:Setmodel() creates T shape

When I use SetModel() it creates a T shaped playermodel even though it has been precached.

Client:


model = unpack(pmShopmodels, mdlnum)
			chat.AddText(Color(255,255,255), 'You bought ' .. model .. ' for $' .. money .. "!")
			net.Start("pmShopbuy")
				net.WriteString(model)
			net.SendToServer()

Server:


util.AddNetworkString( "pmShopbuy" )
util.PrecacheModel( "models/mossman.mdl" )
function pmShopbuy(_,ply)
	model = net.ReadString()
	ply:SetModel(model)
end
net.Receive( "pmShopbuy", pmShopbuy)

Result:

http://upload.flexurr.co.uk/i/454gv.png

Any help would be appreciated! Thanks :slight_smile:

Your not using the models/player path for that specific model

That’s Mossman’s NPC model. Check the models/player/ folder.

If that’s the issue I’m going to cry, testing now

[editline]20th November 2016[/editline]

/solved

I am an idiot and used NPC models… Thanks guys :smiley:

You’re doing insecure networking.

You should have a table in a shared file with indexes to identify what the player wants.

The player would then network the id to the server and the server does verification of money, the players usergroup etc on the server which is where its supposed to verify.

Read the bottom bit in this https://wiki.garrysmod.com/page/Net_Library_Usage