Error running Lua task: [6DA6292CB3210D46] weapon swap:24: attempt to index a nil value (global 'player')
I need help debugging and fixing this code has anyone else experienced or fixed this type of error?
script from sections 23-29
function EquipNextWeapon(Player)
player.serverUserData.weaponindex = player.serverUserData.weaponindex + 1
if player.serverUserData.weaponIndex > NB_WEAPONS then
player.serverUserData.weaponIndex = 1
end
SpawnAndEquipWeapon(player, player.serverUserData.weaponindex)
end
Hello, and welcome to the forum.
Make sure that you use the correct capitalization on the player parameter.
In this case it should be function EquipNextWeapon(player)
with a lowercase "p"
Hope this solves your problem. Let me know if you need any more help.
Tyvm mehgyver I will give it a try.