Server Invoke wont pass

hello its me again. I have ran into a problem with remote functions and i don’t know how to fix it. The problem that i an facing is that the equip remote function wont pass.

script for invoking the remote function on the client
coroutine.wrap(function()
		local pass = game.ReplicatedStorage.weaponRemotes.equip:InvokeServer(wepName)
		if not pass then print('bruh') end
	end)()
Server Script
remots:WaitForChild("equip").OnServerInvoke  = function(plr, wepName)
	print('1')

	if players[plr.UserId].currentWeapon then return end
	print('2')

	print('3')
	if not players[plr.UserId].weapons[wepName] then return end
	print('4')

	if not plr.Character then return end 
	print('5')

	local weaponTable = players[plr.UserId]

	-- we mark the current gun
	weaponTable.currentWeapon = weaponTable.weapons[wepName] 
	print('jjjjj')
	
	return true
end
The output

https://gyazo.com/0f16813d48d7c1311b440b6023602dad

again i am really sorry if this is worded poorly
this answer might already be on the devform but i am not sure what i am suppose to search

The problem doesnt appear to be with anything you’ve shown
It seems like you either are giving an invalid weapon name, do not have the weapon, invalidly added the weapon, or some other problem of that nature

i will try to see if this is the problem

When doing players[plr.UserId] this will not work.

Try players[plr.Name]

1 Like

holy that works thank you!!! :slight_smile: