I want to use chat.AddText for some things in an script i’m writing, however for some reason no matter what I it just shows me this error:
[ERROR] lua/pointshop/items/sniper/weapon_zm_rifle_ps.lua:5: attempt to index global 'chat' (a nil value)
1. OnBuy - lua/pointshop/items/sniper/weapon_zm_rifle_ps.lua:5
2. PS_BuyItem - lua/pointshop/sv_player_extension.lua:254
3. func - lua/pointshop/sv_init.lua:13
4. unknown - lua/includes/extensions/net.lua:32
From this code:
function ITEM:OnBuy(ply)
chat.AddText( Color( 100, 100, 255 ), ply, ", how are you doing?" )
ply:Give(self.WeaponClass)
end
and/or
concommand.Add( "chattext", function(ply)
chat.AddText( Color( 100, 100, 255 ), ply, ", how are you doing?" )
end )
Yes, I’ve tried
if CLIENT then
It doesn’t do anything then.
I’m really irritated, because I’ve used chat.AddText before and it worked. What’s wrong now?
–Santifocus