Clientside Model not drawing for other players?

I’m using clientside models to put as a hat and it’s not seeming to work as I hoped. When I go into third person I can see my hat but when I ask other players if I have a hat on they say, “no”.

Where are you doing this, in a gamemode?

yes

[editline]23rd October 2010[/editline]

Perhaps setting nodraw to false when in PostPlayerDraw will fix it?

[editline]23rd October 2010[/editline]

updated the code, I messed with it a little to try and fix it before I posted and I forgot to change it back.

I still haven’t gotten this fixed, so…

bump.

[lua]
LocalPlayer()._Hat = {etc etc…
[/lua]
You have to set the hat for each player, not just the localplayer. Since it’s clientside it will only be visible to the client it’s executed on and thus each client will only be able to see their own hat.

So I would have to get every player and send a usermessage to everyone? Then everyone would have the same hat on if I’m not mistaken. Is there a way I can fix this?

The best way is to send a usermessage from the server to all the clients whenever someone puts on a hat.

So I would get every player then if they are not the one who is wearing it then I would find the one wearing it and do v._Hat = { Model… }

Yeah, or you could just send the player with the hat in the usermessage.

Could you please explain?

Server
[lua]
function SetHat(ply,model)

local filter = RecipientFilter()
filter:AddAllPlayers()
filter:RemovePlayer(ply)

umsg.Start("Hatz",filter)
    umsg.Entity(ply)
    umsg.String(model)
umg.End()

end
[/lua]

Client
[lua]
usermessage.Hook(“Hatz”,function(msg)

msg:ReadEntity()._Hat = CHats[msg:ReadString()]

end
[/lua]