Friend Function Issue

Hello I need help with “IsFriendWith”, I’m trying to use it to check if two players are friends to make an house system. I’m using a Server script and a Module script, the first is located inside a Part and it deals with the Touch function, the second is the container where I store the code that the Server has to run in different cases. There is an issue, the friend function doesn’t work, I passed UserId between Server Script and Module but it doesn’t work: it gives me this: “attempt to index nil with ‘UserId’”

TouchPart.Touched:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	
	if plr then
		local plr_Code = plr.UserId

		module.Permission(player, plr, plr_Code, PlotVal.Value, PermVal.Value)
	end
end)

1 Like