Can you use remotefunctions with arguments

I’m trying to do this

-- client
for i, v in pairs(children) do
	if v:IsA("ImageButton") and v.Name ~= "Booksona" then
		v.Visible = false
		
		local ok = remote:InvokeServer(v.Name)
		
		if ok == true then
			v.Visible = true
		end
	end
end
-- server
local function bruh(player, name)
	return BadgeService:UserHasBadgeAsync(player.UserId, IDs[name])
end

remote.OnServerInvoke = bruh()

but it’s saying on the second line of the server script that argument 2 is missing or nil.

1 Like

You don’t include parentheses when setting a remote functions OnServerInvoke. It should just be remote.OnServerInvoke = bruh this is because when you include the () it will call the function instead of setting it to a reference to the function

3 Likes

you’re trying to get a value from an undefined table?

1 Like

No I just didn’t include the table in that snippet of code. Didn’t feel it was necessary but it’s there.

It’s also like really long