I’m creating a gamemode and i need a buy menu where a player can buy weapons from. I have to have the menu client side because the function to open the menu must be client sided. I would like to either know how i can put
hook.Add( "Think", "BM_Clients_Key", function() if input.IsKeyDown( KEY_B ) then BuyMenu() end end )
client side seperately while holding the menu server side, so i can run ply:Give in the file, or how to run ply:Give on a seperate server-side file from the client-side buy menu.
local Shotgun = vgui.Create( "DButton", BackGround ) Shotgun:SetSize( 150, 150 ) Shotgun:SetText( "Shotgun" ) Shotgun:SetPos( 10, 10 ) function Shotgun:DoClick() ply:Give( "weapon_shotgun" ) end
While i’m here, i might as well ask how i can get the input:IsKeyDown to run once per press so it doesnt open 60 menus per second