Basically what the title says. I want the chat to print a message only for the user upon attack and to tell when the ability is toggled. It’s better described through the code itself:
function SWEP:PrimaryAttack() self:SendWeaponAnim( ACT_SLAM_DETONATOR_DETONATE ) self.Owner:EmitSound( "player/suit_sprint.wav" ) if FallMode == 0 then FallMode = 1 LocalPlayer():ChatPrint("Anti-Fall Damage enabled.") self.Owner.ShouldReduceFallDamage = true elseif FallMode == 1 then FallMode = 0 LocalPlayer():ChatPrint("Anti-Fall Damage disabled.") self.Owner.ShouldReduceFallDamage = false end end
This error prints in console upon usage, though the chat message does print:
[ERROR] addons/nutscript 1.1/lua/weapons/nut_aug_fall.lua:88: attempt to call global 'LocalPlayer' (a nil value) 1. unknown - addons/nutscript 1.1/lua/weapons/nut_aug_fall.lua:88
I’ve learned that this is because I’m using it on a server, which is a problem because I’m making this SWEP for my RP server. Any alternative functions that I can use?