Player:SelectWeapon
Description
Sets the active weapon of the player by its class name.
This will switch the weapon out of prediction, causing delay on the client and WEAPON:Deploy and WEAPON:Holster to be called out of prediction. Try using CUserCmd:SelectWeapon or input.SelectWeapon, instead.
This will trigger the weapon switch event and associated animations. To switch weapons silently, use Player:SetActiveWeapon.
Arguments
1 string className
The class name of the weapon to switch to.
If the player doesn't have the specified weapon, nothing will happen. You can use Player:Give to give the weapon first.
Example
Force the player to switch to toolgun
Example
Selects a random weapon from the player's inventory and switches to it.